Few things
Josiah Carlson
jcarlson at uci.edu
Fri Nov 26 18:58:14 EST 2004
Nick Coghlan <ncoghlan at email.com> wrote:
>
> Josiah Carlson wrote:
> >>A command like this:
> >>print 0x9f, 054135
> >>This prints an hex and octal. I think the syntax for the hex is a bit
> >>ugly; and the syntax for the octal looks just dangerous (and wrong) to
> >>me.
> >
> >
> > Internally those values are Python integers, there would need to be a
> > special way to tag integers as being originally hex or octal. Or the
> > pyc would need to store the fact that it was originally one of those
> > other methods specifically for the print statement.
>
> I believe the OP was objecting to the spelling of "this integer literal is hex"
> and "this integer literal is octal".
>
> Python stole these spellings directly from C. Saying it's ugly without
> suggesting an alternative isn't likely to result in developers taking any
> action, though. (Not that that is particularly likely on this point, regardless)
>
> If the spelling really bothers the OP, the following works:
>
> print int("9f", 16), int("54135", 8)
>
> That's harder to type, is a lot slower at run-time and uses more memory, though.
Perhaps, though I thought he was talking specifically about printing
(hence using a print statement). Regardless, I also don't believe the
"I don't like this" without "this is the way it should be" will result
in anything.
- Josiah
More information about the Python-list
mailing list