When I type small integers with a 0 in front into python, they give weird results. Why is this?
>>> 011
9
>>> 0100
64
>>> 027
23
<
I have tried it out. I have learned a little bit. From Java I know this as a pitfall: A leading zero introduces an octal number. I have colleagues which didn't resp. don't know that after more than years with experience in Java.
Now I was interesting what the behaviour in Python is. I appreciate that change from Python 2 to Python 3. It is pitfall I have never understood why Java (a young language with focus on "beeing easy") could take over that stupid solution from C.
A leading zero as prefix can be accidentally typed (bad solution). 0x for a hexadecimal number is never accidentally typed (good solution). But 0 and o are to similar therefore I think 0o23 in Python is not a perfect solution. 0c23 (octal) would be a better solution in my opinion.