python newbie having strangeness

Joe F. Blow dood at dood.com
Thu Feb 26 23:57:02 EST 2004


>list comprehensions (this is way cool!) - bytes = "AABBCCDD", bytelist = [
>int(bytes[x:x+2],16) for x in range(0,len(bytes),2) ] results in a bytelist
>containing [170, 187, 204, 221]

Wow!!! Tried this out tonight. Very cool! Obviously that's the way to
do it.

The python reference manual totally sucks. It's incredibly difficult
to find what you want in it and it seems to not even mention lots of
stuff. Maybe it's there, but I can't find it. List comprehensions are
barely mentioned, as far as I can tell. When you do find what you want
to know about, it seems like it's explained in as cryptic a way as
possible.

Aaaaarrrrrggggghhhh!!!



>Python has been around a while, and before writing your own hex-to-int
>conversion, it's worth trying to find a way to do it in the language.  Soon

 I looked. Read the above rant.




More information about the Python-list mailing list