Error in parenthesized expression evaluation order

Issue #28 resolved
Carlo Emmanoel Tolla de Oliveira
created an issue

Test Code

Addition is evaluated before multiplication due to the parenthesized expression

assert (10*(2//2)+1) == 11, 'Error in parenthesized expression %d'%(10*(2//2)+1)
print('Ok')

Expected and Actual Results

Expected

Ok

Actual

AssertionError: Error in parenthesized expression 20 module 'main,exec' line 1 assert (10(2//2)+1) == 11, 'Error in parenthesized expression %d'%(10(2//2)+1)


Test Environment

Brython version: 1.1.20130406-163805

Gnome Ubuntu 12.10 Quantal - Firefox 19.0.2

Additional Information

Works ok in Python 3

Python 3.2.3 (default, Sep 30 2012, 16:41:36) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> assert (10*(2//2)+1) == 11, 'Error in parenthesized expression %d'%(10*(2//2)+1)
>>> print('Ok')
Ok

Comments (2)

  1. Olemis Lang repo owner

    I've found this expression is not evaluated correctly either

    Expected

    $ python3
    Python 3.1.2 (r312:79147, Dec  9 2011, 20:47:34) 
    [GCC 4.4.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> (1,2).__class__
    <class 'tuple'>
    

    Actual

    (1,<function int>)

  2. Log in to comment