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

Boolean And should return first falsey value #56

Merged
merged 3 commits into from
Jun 19, 2019

Conversation

readevalprint
Copy link
Contributor

I think boolean And should return the first falsey result like python and not literal False:

>>> True and [] and True
[]

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0004%) to 99.671% when pulling 3ea190b on readevalprint:master into 164ee88 on danthedeckie:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.0004%) to 99.671% when pulling 3ea190b on readevalprint:master into 164ee88 on danthedeckie:master.

@coveralls
Copy link

coveralls commented Apr 29, 2019

Coverage Status

Coverage increased (+0.0004%) to 99.671% when pulling 39799f9 on readevalprint:master into 164ee88 on danthedeckie:master.

@readevalprint
Copy link
Contributor Author

I'm not sure why the test passed. I'm getting this result with the master branch:

>>> simple_eval("True and 0")
False

@Birne94
Copy link
Contributor

Birne94 commented Apr 29, 2019

It most likely works because python booleans are integers under the hood:

In [1]: True == 1
Out[1]: True

In [2]: False == 0
Out[2]: True

@danthedeckie
Copy link
Owner

Thanks @readevalprint and @Birne94 ! This is great :-)
Sorry I've been away / offline a lot recently so it took me so long.

@danthedeckie danthedeckie merged commit b47858d into danthedeckie:master Jun 19, 2019
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

Successfully merging this pull request may close these issues.

4 participants