pylint-bot / test

0 stars 0 forks source link

Introduce a new Arg node for Python 3 function arguments #134

Closed pylint-bot closed 8 years ago

pylint-bot commented 9 years ago

Originally reported by: Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore?)


We currently don't have an Arg node for Python 3's arguments, because we are using AssName instead (this is how it works on Python 2).

#!python

>>> from ast import parse
>>> x = parse('''
... def test(a): pass
... ''')
>>> print(x)
<_ast.Module object at 0x0000000DBEF6F908>
>>> x.body
[<_ast.FunctionDef object at 0x0000000DBEF6F940>]
>>> x.body[0]
<_ast.FunctionDef object at 0x0000000DBEF6F940>
>>> x.body[0].args
<_ast.arguments object at 0x0000000DBEF6FA20>
>>> x.body[0].args.args
[<_ast.arg object at 0x0000000DBEF76A58>]
>>>

pylint-bot commented 8 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore?):


In fact, it's nicer to have AssName instead of a new Arg node, since it needs to be the same on both Python 2 and Python 3. Introducing a new node will change that requirement.