Proposal: Decimal literals in Python.

Neil Cerutti horpner at yahoo.com
Sat Oct 27 19:10:42 EDT 2007


On 2007-10-27, Marc 'BlackJack' Rintsch <bj_666 at gmx.net> wrote:
> On Sat, 27 Oct 2007 13:28:02 -0500, Tim Chase wrote:
>
>>>> Even clearer is not to allow octal literals :) Is there *any* use for
>>>> them?
>>> 
>>> The mode argument to os.chmod.
>> 
>> You mean instead of
>> 
>>   import this
>>   os.chmod(filename, os.R_OK | os.W_OK | os.X_OK)
>> 
>> which explicitly (rather than implicitly) spells it out?
>
> And the equivalent of ``os.chmod(filename, 0777)`` looks like what!?

os.chmod(filename, int('777', 8))

It's good enough for most other bases. ;)

-- 
Neil Cerutti



More information about the Python-list mailing list