This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jcon
Recipients benjamin.peterson, ezio.melotti, jcon, pitrou, vstinner
Date 2011-08-24.22:57:39
SpamBayes Score 8.337386e-12
Marked as misclassified No
Message-id <1314226660.07.0.0414636259993.issue12807@psf.upfronthosting.co.za>
In-reply-to
Content
Antoine Pitrou <pitrou@free.fr> added the comment:

> This looks like a dubious micro-optimization. If len == 0,
> all loops will exit early anyway (same for similar snippets in bytesobject.c and unicodeobject.c).

You are right about those lines in particular; 'dubious' as you say. 
Though, the point overall was that the general implementation was noticeably
faster (regardless of those smaller changes). 

However, I do think that the single check for len == 0 saves time particularly
from do_xstrip where we call _getbuffer().


> bytearray objects are mutable, so you can't return the same object without breaking expected semantics. e.g.:

I see. I must have been trigger happy.


> diff -r b5ccdf7c032a Python/bltinmodule.c
> Binary file Python/bltinmodule.c has changed

> Uh, what's this? bltinmodule.c shouldn't be considered a binary file.
> It probably means you added a NUL byte in it by mistake.

I didn't touch that file at all. I'm not sure what that is. :-P

> You could put it in Objects/stringlib.

I figured. I will when I am able to get to it.
History
Date User Action Args
2011-08-24 22:57:40jconsetrecipients: + jcon, pitrou, vstinner, benjamin.peterson, ezio.melotti
2011-08-24 22:57:40jconsetmessageid: <1314226660.07.0.0414636259993.issue12807@psf.upfronthosting.co.za>
2011-08-24 22:57:39jconlinkissue12807 messages
2011-08-24 22:57:39jconcreate