[ python-Bugs-691733 ] Let assign to as raise SyntaxWarning as well

SourceForge.net noreply at sourceforge.net
Tue May 31 13:23:10 CEST 2005


Bugs item #691733, was opened at 2003-02-23 18:08
Message generated for change (Comment added) made by birkenfeld
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: Open
Resolution: None
Priority: 2
Submitted By: Gerrit Holl (gerrit)
Assigned to: Nobody/Anonymous (nobody)
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: Reinhold Birkenfeld (birkenfeld)
Date: 2005-05-31 13: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 18: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


More information about the Python-bugs-list mailing list