New submission from Kay Hayen <kayha...@gmx.de>: Please check the following:
[GCC 4.4.5 20100728 (prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import compiler >>> compiler.parse( "d[1,] = None" ) Module(None, Stmt([Assign([Subscript(Name('d'), 'OP_ASSIGN', [Const(1)])], Name('None'))])) >>> compiler.parse( "d[1] = None" ) Module(None, Stmt([Assign([Subscript(Name('d'), 'OP_ASSIGN', [Const(1)])], Name('None'))])) >>> d = {} >>> d[1,] = None >>> d[1] = None >>> d {1: None, (1,): None} As you can see d[1] = None and d[1,] = None do different things, but do they lead to the same abstract syntax tree. It's the same on Python 2.7: Python 2.7.0+ (r27:82500, Aug 7 2010, 19:41:51) [GCC 4.4.5 20100728 (prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import compiler >>> compiler.parse( "d[1,] = None" ) Module(None, Stmt([Assign([Subscript(Name('d'), 'OP_ASSIGN', [Const(1)])], Name('None'))])) >>> compiler.parse( "d[1] = None" ) Module(None, Stmt([Assign([Subscript(Name('d'), 'OP_ASSIGN', [Const(1)])], Name('None'))])) ---------- components: Library (Lib) messages: 114507 nosy: kayhayen priority: normal severity: normal status: open title: compiler module provides wrong AST for extended slice of length 1 type: behavior versions: Python 2.6, Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9656> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com