Bugs item #691733, was opened at 2003-02-23 09:08 Message generated for change (Comment added) made by nnorwitz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=691733&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Parser/Compiler Group: Python 2.5 >Status: Closed >Resolution: Fixed Priority: 2 Submitted By: Gerrit Holl (gerrit) >Assigned to: Neal Norwitz (nnorwitz) Summary: Let assign to as raise SyntaxWarning as well Initial Comment: according to the Python Language Reference Manual: > 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 >>> For consistency and cleanliness, assignment to 'as' should raise a SyntaxWarning as well. Currently, it's possible to not know it'll be a keyword and use it as a variable; people shouldn't, so a SyntaxWarning would be good. ---------------------------------------------------------------------- >Comment By: Neal Norwitz (nnorwitz) Date: 2006-10-07 15:37 Message: Logged In: YES user_id=33168 The warning was added for 2.5 and 2.6 this produces an error. Python 2.5 (release25-maint:51996M, Sep 26 2006, 00:14:14) >>> as = None <stdin>:1: Warning: 'as' will become a reserved keyword in Python 2.6 Python 2.6a0 (trunk:51986M, Oct 7 2006, 15:36:46) >>> as = None File "<stdin>", line 1 as = None ^ SyntaxError: invalid syntax ---------------------------------------------------------------------- Comment By: Georg Brandl (birkenfeld) Date: 2005-08-31 14:59 Message: Logged In: YES user_id=1188172 For Py2.5, "with" and "as" will become keywords. However, that will need "from __future__ import with_statement". So I suggest to raise SyntaxWarning in 2.5 without this statement if with or as are used as names. ---------------------------------------------------------------------- Comment By: Georg Brandl (birkenfeld) Date: 2005-05-31 04:23 Message: Logged In: YES user_id=1188172 This may be too late if as becomes a keyword in the new with/do/whatever-statement... ---------------------------------------------------------------------- Comment By: Gerrit Holl (gerrit) Date: 2003-02-23 09:21 Message: Logged In: YES user_id=13298 I'm not sure whether this should be considered as a feature. I'd call it a minor wart... I'm also not sure about the category, is this 'Python interpreter core' or am I right with 'parser/compiler'? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=691733&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com