On 2007-01-30, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Tue, 30 Jan 2007 06:34:01 -0300, Beej <[EMAIL PROTECTED]> escribió: > >> But here's one I still don't get: >> >>>>> type(2) >> <type 'int'> >>>>> type((2)) >> <type 'int'> >>>>> (2).__add__(1) >> 3 >>>>> 2.__add__(1) >> File "<stdin>", line 1 >> 2.__add__(1) >> ^ >> SyntaxError: invalid syntax > > It appears to be a bug, either in the grammar implementation, or in the > grammar documentation. > These are the relevant rules: > > attributeref ::= primary "." identifier > > primary ::= atom | attributeref | subscription | slicing | call > > atom ::= identifier | literal | enclosure > > literal ::= stringliteral | integer | longinteger | floatnumber | > imagnumber > > An integer is a primary so 2.__add(1) should be valid.
Not if the tokenizer passes the parser a float. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list