Why gives "k = 09" a syntax error ?

Mensanator mensanator at aol.com
Thu Oct 30 00:44:11 EDT 2008


On Oct 29, 4:17�pm, cla... at lairds.us (Cameron Laird) wrote:
> In article <6772c5db-cdcc-4f79-9a24-1da8e849c... at 34g2000hsh.googlegroups.com>,
>
>
>
> Mensanator �<mensana... at aol.com> wrote:
> >On Oct 29, 2:44�pm, Stef Mientki <stef.mien... at gmail.com> wrote:
> >> Guilherme Polo wrote:
> >> > On 10/29/08, Stef Mientki <stef.mien... at gmail.com> wrote:
>
> >> >> hello,
>
> >> >> �Why gives "k = 09" �a syntax error ?
>
> >> > 09 is not a valid octal number. Instead use 011.
>
> >> > Ok, I guess you were not aware that prefixing a number with a '0'
> >> > would cause python to parse it as an octal and now you know.
>
> >> thanks guys,
> >> I didn't realize there were still people using octal notation ;-)
>
> >Windows users don't have much need for it, but it's still
> >popular with the 'Nix crowd.
>
> � � � � � � � � � � � � .
> � � � � � � � � � � � � .
> � � � � � � � � � � � � .
> I contest that; my observation is that it's entirely an artifact
> of legacy software,

Really? Don't they still use octal for this stuff?

$ ls -l
total 1717
-r-xr-x---+  1 mensanator Users     57 Mar 29  2008 Cygwin.bat
-r-xr-x---+  1 mensanator Users   7022 Mar 29  2008 Cygwin.ico
d---------+  5 mensanator None       0 Apr 21  2008 Seed7
-rwxr-xr-x   1 mensanator None   15870 Apr 11  2008 a.exe
    |
This would be 0755, wouldn't it? You certainly wouldn't want
to try to figure out the decimal equivalent.

? and regarded as no better than a distraction
> by even the most narrow human 'Nixers,

Appears necessary to me.

> or the hardware types who
> might at one time have found octal natural. �My own origins were
> in hardware, Unix, and other DEC OSs, so I consider myself as
> likely as anyone to think in octal--and I rarely do.
>
> While I can't accept the "popular" part,

I meant popular as in ubiquitous, not that I imagined there was
anybody who liked to use it.

> I agree with you that
> Unix people are at least more likely to recognize the 0-prefix.




More information about the Python-list mailing list