Proposal: Decimal literals in Python.

J. Cliff Dyer jcd at sdf.lonestar.org
Sat Oct 27 16:36:52 EDT 2007


Marc 'BlackJack' Rintsch 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!?
>
> Ciao,
> 	Marc 'BlackJack' Rintsch
>   
Ugly.

But is one function in one library, which doesn't even exist in one of
the major operating systems really worth its own syntactic construct in
the language?  It seems that it would be fairly simple for python to
treat the octal argument as a string, rather than an int:

os.chmod(filename, "777")

If somebody had a good *general* use for octal, it might be worth having
in the language.  Otherwise, it seems like an unused which is only kept
around because it used to get played with.  (back in the days of six bit
hardware?)

Cheers,
Cliff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071027/412b8ec1/attachment.html>


More information about the Python-list mailing list