A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-August/037864.html below:

[Python-Dev] Extending hex() and oct() to accept strings

[Python-Dev] Extending hex() and oct() to accept strings [Python-Dev] Extending hex() and oct() to accept stringsMatthew F. Barnes mfb at lotusland.dyndns.org
Thu Aug 28 09:20:06 EDT 2003
>>   >>> import binascii
>>   >>> binascii.hexlify('ABC')
>>   '414243'
>>   >>>
>
> Or
>
>         >>> 'ABC'.encode('hex_codec')
>         '414243'
>
>         >>> '414243'.decode('hex_codec')
>         'ABC'

The only defense I can think to offer for the hex() and oct() idea is that
I felt like there was something significant about the fact that it was the
first thing I thought to try.  It seemed like the "obvious" way to do it.

While both of these solutions are quite readable now that I see them, I'm
not sure that I'd call either of them obvious.  However, I can certainly
appreciate the cost of adding bells and whistles to the language,
especially for something that would probably not see much use (as Guido
pointed out).

Thank you both for the tips.

Matthew Barnes

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4