[Patches] [ python-Patches-549213 ] warn on assignment to None, True, False
noreply@sourceforge.net
noreply@sourceforge.net
Sat, 14 Dec 2002 06:17:54 -0800
Patches item #549213, was opened at 2002-04-26 21:14
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=549213&group_id=5470
Category: Parser/Compiler
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jeremy Hylton (jhylton)
Assigned to: Jeremy Hylton (jhylton)
Summary: warn on assignment to None, True, False
Initial Comment:
This patch issues a warning when None, True, or False
is assigned to. I don't know what the text of the
warning should say, but that's a minor matter.
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2002-12-14 15:17
Message:
Logged In: YES
user_id=21627
Is this going to be part of Python 2.3?
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2002-04-26 22:44
Message:
Logged In: YES
user_id=6380
Better. Some strange behavior remains:
from foo import None # gives three warnings!
import None # gives two warnings!
We need a test suite that systematically tests all cases.
----------------------------------------------------------------------
Comment By: Jeremy Hylton (jhylton)
Date: 2002-04-26 22:30
Message:
Logged In: YES
user_id=31392
Here's an improved pass, although the calls are getting a
bit messy. Not sure how worried I am, since I'd like to
replace this code anyway. (The worry is that I don't get
around to replacing it before 2.3.)
Also, fix com_arglist() to do only the work that is necessary.
----------------------------------------------------------------------
Comment By: Jeremy Hylton (jhylton)
Date: 2002-04-26 21:34
Message:
Logged In: YES
user_id=31392
Right. I'll have to fiddle the patch to make the check into
a function and we can see where else it should be applied.
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2002-04-26 21:28
Message:
Logged In: YES
user_id=6380
Nice, but doesn't catch enough cases. E.g. using None as an
argument name, assigning to an attribute named None, "import
foo.None", "from foo.None import bar", "from None import
bar", "from None.foo import bar", using None as a keyword
argument in a call: "f(1, 2, None=3)".
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=549213&group_id=5470