[Python-bugs-list] [ python-Bugs-604036 ] spurious SyntaxWarning

noreply@sourceforge.net noreply@sourceforge.net
Wed, 11 Sep 2002 09:49:35 -0700


Bugs item #604036, was opened at 2002-09-03 18:05
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=604036&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Nobody/Anonymous (nobody)
Summary: spurious SyntaxWarning

Initial Comment:
The compiler now warns about assignment to None, however it trips 
up on this innocuous optimization:

    from __builtin__ import None


----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2002-09-11 18:49

Message:
Logged In: YES 
user_id=21627

This is not a bug (IMO). The SyntaxWarning is a step on the
way of making None a keyword, at which point " from
__builtin__ import None" will become a SyntaxError.
Therefore, the compiler must warn about that today,
according to PEP 5.

----------------------------------------------------------------------

Comment By: Jeremy Hylton (jhylton)
Date: 2002-09-04 00:38

Message:
Logged In: YES 
user_id=31392

Right, in this particular case it is safe.  The programmer
can also use the warnings module to stop the warning about
the optimization.  The same would happen is someone used
"None=None" in an argument list.


----------------------------------------------------------------------

Comment By: Skip Montanaro (montanaro)
Date: 2002-09-04 00:35

Message:
Logged In: YES 
user_id=44345

Granted, perhaps it's not.  In this case it is.  The programmer was 
copying None from builtins to the local scope to speed up access to that 
object.  If they had done something like

    None = 87

I would have expected a warning.


----------------------------------------------------------------------

Comment By: Jeremy Hylton (jhylton)
Date: 2002-09-04 00:21

Message:
Logged In: YES 
user_id=31392

Maybe it isn't innocuous.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=604036&group_id=5470