[OT] Octal number syntax (Was: Please stop re-adding gtk-update-icon-cache scriptlets)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/20/2018 06:08 AM, Chris Adams wrote:
Once upon a time, Nico Kadel-Garcia <nkadel@xxxxxxxxx> said:
I don't see any modern scripting language where a leading 0 would lead
to interpreting a number as octal.

I suggest you check again; I don't see any where a leading 0 does NOT
lead to interpreting a number as octal  Here are a few common scripting
languages (just what I have installed):

$ python -c 'print(010 + 1)'
9

Fedora's /usr/bin/python is not a modern scripting language, but a 7-years-old one with even older historical baggage. We're working on fixing that, but there are serious backwards compatibility issues :) </rant>

Generally, the movement is away from leading 0 meaning octal.
Current Python does not allow this. It was removed exactly because it was "extremely easy to inadvertently [specify] the wrong value" [0], especially for people without a C/Unix background. Instead, there's the explicit "0o" prefix, which also works in Python 2, Ruby, JavaScript (ES6), Perl 6, ... even Rust. An you're likely to see style guides and linters warning against leading 0 in languages that keep it.

You could say RPM is ahead of its time here!


[0]: https://www.python.org/dev/peps/pep-3127/#motivation


--
Petr Viktorin
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux