Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expression does not give expected result #13

Closed
sawan opened this issue Apr 18, 2016 · 2 comments
Closed

Expression does not give expected result #13

sawan opened this issue Apr 18, 2016 · 2 comments

Comments

@sawan
Copy link

sawan commented Apr 18, 2016

Consider the following:

out = True
position = 3
expr = '(out and position <=6 and -10) or (out and position > 6 and -5) or (not out and 15)'

simple_eval(expr, names={'out': True, 'position': 3} )

gives the result

True

This is wrong. Using

eval(expr)

we get the correct result:

-10

Is this a bug? Or intentional?

@danthedeckie
Copy link
Owner

hm. I think it could be a bug. it can actually be demonstrated even simpler:

False or 42

42

simple_eval("False or 42")

True

@danthedeckie
Copy link
Owner

I think I fixed it in that commit. So I'll call it closed. If I'm wrong, please re open it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants