Speed of string += string
Greg Ewing (using news.cis.dfn.de)
ckea25d02 at sneakemail.com
Mon Apr 14 02:22:39 EDT 2003
More information about the Python-list mailing list
Mon Apr 14 02:22:39 EDT 2003
- Previous message (by thread): Speed of string += string
- Next message (by thread): Speed of string += string
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
achrist at easystreet.com wrote: > Now, which is preferred: > > if astring == "": > > or > > if len(astring) == 0: The first ought to be faster, since it avoids a global name lookup and a Python function call, both of which are fairly expensive. But better still would be simply if astring: ... -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg
- Previous message (by thread): Speed of string += string
- Next message (by thread): Speed of string += string
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list