[Python-3000] [Email-SIG] fix email module for python 3000 (bytes/str)

Victor Stinner victor.stinner at haypocalc.com
Tue Aug 14 03:52:45 CEST 2007


Hi,

On Monday 13 August 2007 19:51:18 Guido van Rossum wrote:
> Checked in. But next time please do use SF to submit patches (and feel
> free to assign them to me and mail the list about it).

Ah yes, you already asked to use SF. I will use it next time.

> On 8/12/07, Victor Stinner <victor.stinner at haypocalc.com> wrote:
> > On Sunday 12 August 2007 16:50:05 Barry Warsaw wrote:
> > > In r56957 I committed changes to sndhdr.py and imghdr.py so that they
> > > compare what they read out of the files against proper byte
> > > literals.
> >
> > So nobody read my patches?
> > (...) 
> > I attached a new patch 
> > (...)
> >  - use ord(b'P') instead of ord('P')
>
> This latter one is questionable. If you really want to compare to
> bytes, perhaps write h[:1] == b'P' instead of b[0] == ord(b'P')?

Someone proposed c'P' syntax for ord(b'P') which is like an alias for 80.

I prefer letters than number when letters have sens.

I also think (I may be wrong) that b'xyz'[0] == 80 is faster than b'xyz'[:1] 
== b'x' since b'xyz'[:1] creates a new object. If we keep speed argument, 
b'xyz'[0] == ord(b'P') may be slower than b'xyz'[:1] == b'x' since ord(b'P') 
is recomputed each time (is it right?).

But well, speed argument is stupid since it's a micro-optimization :-)

Victor Stinner aka haypo
http://hachoir.org/


More information about the Python-3000 mailing list