assigning to None vs. assigning to as 
Author Message
 assigning to None vs. assigning to as

Hi,

according to the python Language Reference Manual[0]:

Quote:
> 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.*-*-*.com/

--
Asperger Syndroom - een persoonlijke benadering:
        http://www.*-*-*.com/ ~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
        http://www.*-*-*.com/



Thu, 11 Aug 2005 00:34:45 GMT  
 assigning to None vs. assigning to as

Quote:

> Is the reason for the SyntaxWarning raised when assigning to None that it
> may one day be a keywoard?

Yes.

Quote:
> If so,
>     then shouldn't assigning to as have the same behaviour,

Maybe.  There was a bug on sf that went "as should be a proper
keyword".  It was recently closed "wontfix"/"can't be bothered".

I can't see how this is anything other than the tiniest of issues.

Cheers,
M.

--
  If I had wanted your website to make noise I would have{*filter*}ed
  my finger and rubbed it across the monitor.
                           -- signature of "istartedi" on slashdot.org



Tue, 16 Aug 2005 20:47:06 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. wire assign vs continous assign

2. always vs assign

3. force vs. assign

4. ASSIGNed GOTO vs CALL

5. Assigning numbers to a matrix

6. Assigning parent view

7. assign regexp to variable?

8. Assign depending on regexp

9. VW (2.0) Assigning colors to list items????

10. assigning to a part of an object in J

11. Awk: assigning a variable

 

 
Powered by phpBB® Forum Software