Python Gotcha with Octal Numbers

Christopher Saunter Christopher.Saunter at durham.ac.uk
Thu Feb 14 12:35:03 EST 2002


Steve Holden (sholden at holdenweb.com) wrote:
: Chris: Welcome to c.l.py!
Thanks, and thanks to everyone else who has so far replied.  I'll have to
remember the 'holliday' bug with August ;-)

: It might be possible to introduce it as a redundant alternative, but
: generally speaking there's resistance to having more than one way to
: represent something (confuses learners), and this wouldn't anyway have saved
: you from the glitch you experienced.

Yeah.  It'd be nice if there could be a plan to switch to a more obvious
0o over several versions (as is being down with the integer divide) but
it's kind of nice to know that even python has some quirks....
Unfortunatly I started my computing with an 8 bit Amstrad, so I never
experience the old unix boxes...


: Serves you right for being anal about alignment when only the interpreter
: and you were going to read the code <0.9 wink>.

;-)  I guess it's kind of a 'nervous programming tick' or something...

Also, on the subject of number bases, is there an easy (read library)  way
to take a string containing a number represented as hex and convert it to
an int or float?  I've looked through the libraries, and I'm sure it's
there somewhere, just can't find it.....

Regards,
	Chris Saunter



More information about the Python-list mailing list