[Python-3000] String literal representation of integers (octal/binary discussion) (original) (raw)
Thomas Wouters thomas at python.org
Mon Mar 19 01:48:15 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, Patrick Maupin <pmaupin at gmail.com> wrote:
the treatment of string literal representations of integers
I don't think this is the right term. It's certainly confusing, considering "string literals" are the stuff in quotes. A less confusing name is just 'integer literals'.
- There is a strong desire for binary support in the language.
I have yet to see this 'strong desire'. I've seen people remark that they think it'd be nicely symmetric, but requests for actual usecases have always gotten low responses, as far as I remember. I've done quite a bit of bitfiddling with Python, with the struct module or with hexadecimals and bitwise operations, and in none of those cases would a binary literal have been helpful; they're way too verbose and impossible to get right/debug.
But the Python community has its share of minimalists (each with
his own idea of the proper subset), so, for example, Mattias EngdegÄrd wrote: "only decimal, hex and binary constants are of general use at all" while Thomas Wouters opined that octal and hexadecimal should remain but binary was only for misguided students doing their homework.
This strikes me as a rather snide and childish paragraph -- and not just the part about me, which you got wrong. What I said was "they're invariably new programmers tackling the problem as an exercise, or trying to get at the 'pure bits' of an int to perform bitwise operations in an inefficient manner."
So, in general, humans communicate "normal" (non-computer)
numerical information either via names (AM, PM, January, ...) or via use of decimal notation. Obviously, names are seldom used for large sets of items, so decimal is used for everything else. There are studies which attempt to explain why this is so, typically reaching the expected conclusion that the Arabic numeral system is well-suited to human cognition. [3]
I'm not sure why all this matters to the PEP, really. Do we really have to justify having decimal, hexadecimal and octal literals? It's way oversized if you ask me :)
-- Thomas Wouters <thomas at python.org>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-3000/attachments/20070319/ffaa7b60/attachment.html
- 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 ]