[Python-Dev] Python 3.x and bytes
P.J. Eby
pje at telecommunity.com
Tue Jun 14 01:40:29 CEST 2011
At 03:11 PM 6/13/2011 -0700, Ethan Furman wrote:
>Nick Coghlan wrote:
> > Agreed, but:
> >
> > EOH, CHAR, DATE, FLOAT, INT, LOGICAL, MEMO, NUMBER = b'\rCDFILMN'
> >
> > is a shorter way to write the same thing.
> >
> > Going two per line makes it easier to mentally map the characters:
> >
> > EOH, CHAR = b'\rC'
> > DATE, FLOAT = b'DF'
> > INT, LOGICAL = b'IL'
> > MEMO, NUMBER = b'MN'
>
>Wow. I didn't realize that could be done. That very nearly makes
>up for not being able to do it one char at a time.
You can still do it one at a time:
CHAR, = b'C'
INT, = b'I'
...
etc. I just tried it with Python 3.1 and it works there.
More information about the Python-Dev
mailing list