[Python-3000] String literal representation of integers (octal/binary discussion) (original) (raw)
Bob Ippolito bob at redivi.com
Mon Mar 19 23:04:19 CET 2007
- Previous message: [Python-3000] String literal representation of integers (octal/binary discussion)
- Next message: [Python-3000] String literal representation of integers (octal/binary discussion)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 3/18/07, Jim Jewett <jimjjewett at gmail.com> wrote:
On 3/18/07, Guido van Rossum <guido at python.org> wrote: > Octal does need to be justified, since some people argued to remove > it. I guess binary needs to be justified because Thomas doesn't see > the need. :-)
I see literals for octal and binary as similar to raising a tuple, or automatically unpacking one in a function call. It can be useful, but it isn't needed very often. When it does show up, it can be confusing because it is so rare.
Binary is pretty useful for expressing some algorithms or for dealing with bit flags. Not something you do terribly often if you're living in an end to end Python universe but I've certainly wanted to use them now and again, mostly when parsing strange file formats. Instead I just ended up getting better at visualizing things that are conceptually binary as hex digits (4 bits at a time).
It would absolutely help if there was an obvious way to get a string of 1s and 0s out of an integer given the number of bits you want to write it as (I've written libraries to do this and to work with bits as lists of 1 and 0). I'm not sure I care about literals anymore though... but I'm at least +0 on them.
-bob
- Previous message: [Python-3000] String literal representation of integers (octal/binary discussion)
- Next message: [Python-3000] String literal representation of integers (octal/binary discussion)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]