Getting hex value of a character

Peter Hansen peter at engcorp.com
Thu Dec 12 14:17:52 EST 2002


"Aaron K. Johnson" wrote:
> 
> I'm laughing at all the solutions in this thread,some using map(), some using
> lib functions like binascii.hexlify(), all great and correct, all different.
> I'm laughing because Perl gets the reputaion for "there's more the one way to
> do it", and Python for "There's one way to do it", 

Python's version, from http://www.python.org/dev/culture.html or "import this" is 

  "There should be one -- and preferably only one -- obvious way to do it."

This says nothing about whether there are more than one way to do something,
only that there should be only one _obvious_ way.

> which is, as we now see, a crock of shit!

Well, the more likely reason so many differing suggestions were made is 
that the posters didn't yet know about or remember binascii.  Having seen 
it more than a few times now, those with all the map/lambda suggestions 
will probably be more likely to "import binascii" the next time they need 
a simple solution.

-glad-to-get-the-reminder-again-ly yr's,
 Peter



More information about the Python-list mailing list