Checking python grammar for official documentation is what it reads
atom_expr: ['await'] atom trailer*
atom: ('(' [yield_expr|testlist_comp] ')' |
'[' [testlist_comp] ']' |
'{' [dictorsetmaker] '}' |
NAME | NUMBER | STRING+ | '...' | 'None' | 'True' | 'False')
testlist_comp: (test|star_expr) ( comp_for | (',' (test|star_expr))* [','] )
trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
It 10.bit_length()is then valid syntax according to this definition, but not according to the python interpreter. Instead, it n=10;n.bit_length()is a valid syntax for both specifications and the interpreter.
Where can I find a real definition atomand atom_expr?
source
share