Batuhan Taskaya <[email protected]> added the comment:
The initial aim of the dis.Positions was to provide an interface like AST
nodes. So you could do
for instr in dis.Bytecode(source):
print("located in: ", instr.positions.lineno)
instead of
for instr in dis.Bytecode(source):
if instr.positions:
lineno = instr.positions[0]
else:
lineno = None
print("located in: ", lineno)
I think this is a bug that we are not currently using it, I'd say we should use
it properly and go with option 2.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46422>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com