Bugs item #1715581, was opened at 2007-05-09 05:53
Message generated for change (Comment added) made by collinwinter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1715581&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: Python Library
Group: Python 2.5
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Private: No
Submitted By: Ali Gholami Rudi (aligrudi)
>Assigned to: Collin Winter (collinwinter)
Summary: Const(None) in compiler.ast.Return.value
Initial Comment:
The problem happens when::
import compiler
class Visitor(object):
def visitReturn(self, node):
print node.value
source = """
def f():
return
"""
compiler.walk(compiler.parse(source), Visitor())
I think the value of `node.value` should have been `None` instead of
`Const(None)` as it is for most other nodes when an optional part is
missing. The same problem (getting `Const(None)` instead of `None`)
exists for `Sliceobj.nodes[i]` and `Discard.expr`.
----------------------------------------------------------------------
>Comment By: Collin Winter (collinwinter)
Date: 2007-06-05 13:47
Message:
Logged In: YES
user_id=1344176
Originator: NO
"return" is syntactic shorthand for "return None", so Const(None) is the
right value; same thing for Sliceobj. This isn't a bug.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1715581&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com