3 ms·
Using an initial 0 to indicate octal is a terrible convention. I’m very glad that Python 3 makes 0123 into a syntax error, and uses the form 0o123 instead for o
by jacobolus 11y ago
Using an initial 0 to indicate octal is a terrible convention. I’m very glad that Python 3 makes 0123 into a syntax error, and uses the form 0o123 instead for octal literals, to match the style of 0x53 (also adds 0b1010011 for binary).
- Tiksi 11y agoI wonder if there's a reason for keeping the leading 0 there past tradition/convention. 0x as a prefix makes sense to differentiate between 0x12 and 012, but if it's 0x 0b and 0o, imo it'd make more sense to drop it and just leave it as o12, b12, x12, etc.
- MaxGabriel 11y agoo12, b12, and x12 are all valid variable names
- Tiksi 11y agoYeah... not sure how that slipped my mind, seems quite obvious now. Thanks
- deleted 11y ago[deleted]
- chj 11y agoI prefer the Scheme way: #x53, #o123, #b1010011 It feels more natural to my taste. We already use #1, #2, ...