[Python-Dev] Usage of += on strings in loops in stdlib (original) (raw)
Alexandre Vassalotti alexandre at peadrop.com
Wed Feb 13 02:09:01 CET 2013
- Previous message: [Python-Dev] Usage of += on strings in loops in stdlib
- Next message: [Python-Dev] Usage of += on strings in loops in stdlib
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Feb 12, 2013 at 1:44 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
It's idiomatic because strings are immutable (by design, not because of an optimization detail) and therefore concatenation has to imply building a new string from scratch.
Not necessarily. It is totally possible to implement strings such they are immutable and concatenation takes O(1): ropes are the canonical example of this. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20130212/3794821d/attachment.html>
- Previous message: [Python-Dev] Usage of += on strings in loops in stdlib
- Next message: [Python-Dev] Usage of += on strings in loops in stdlib
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]