assigning to None vs. assigning to as

Gerrit Holl gerrit at nl.linux.org
Sat Feb 22 11:34:45 EST 2003


Hi,

according to the Python Language Reference Manual[0]:
> In some future version of Python, the identifiers
> as and None will both become keywords.

Hence, it seems natural to me to raise a SyntaxWarning when assigning to
either of these. However, the current Python implementation doesn't:

103 >>> None="foo"
<stdin>:1: SyntaxWarning: assignment to None
104 >>> as="foo"
105 >>>

Is the reason for the SyntaxWarning raised when assigning to None that it
may one day be a keywoard?
If so,
    then shouldn't assigning to as have the same behaviour, and
    maybe more general, shouldn't the parser then know about a list of
    future-keywords which all yield SyntaxWarnings when assigned to?
    If so,
        then can this be considered as a bug? Why?
    If not, if it's intentional,
        then what is the reason for this behaviour?
If not,
    then is the reason for it that it may break code?

yours,
Gerrit.

P.S.
Shouldn't the keyword module know about future keywords?

[0] http://www.python.org/dev/doc/devel/ref/keywords.html

-- 
Asperger Syndroom - een persoonlijke benadering:
	http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
	http://www.sp.nl/





More information about the Python-list mailing list