Skip to content
This repository was archived by the owner on May 31, 2020. It is now read-only.
This repository was archived by the owner on May 31, 2020. It is now read-only.

"in" / "not in" do not work as expected. #724

Description

@sparkslabs

First of all thanks for writing this. I saw the recording of your talk on this on youtube from a pycon or similar and thought it worth trying. Works really well over all. Many thanks!

With that, the bug report...

Expected Behaviour

The following works in CPython:

resource_id = "foo"
user_resources_done = []

if resource_id not in user_resources_done:
    print("Gotta do that")
else:
    print("Done it")

Specifically it generates the following output:

>>> resource_id = "foo"
>>> user_resources_done = []
>>> if resource_id not in user_resources_done:
...     print("Gotta do that")
... else:
...     print("Done it")
... 
Gotta do that
>>> 

Current Behavior

In Batavia, if I use the same code, I get this:

Traceback (most recent call last):
  File "/tmp/tmpsrv0plrf", line 3, in <module>
ValueError: list.index(x): x not in list

Clearly this is a difference in behaviour.

Steps to reproduce

Using the testserver, copy and paste the above code into the "Run your code!" box, and hit "Run your code!"

Your Environment

  • Batavia version - 3.4.0-dev.19
  • Batavia git hash -- 458cb41 (Dated Sun Mar 4 15:26:23 2018 +0800)
  • Ubuntu Linux 16.04.04 -- LTS
  • Python -- 3.5.2
  • node -- v6.13.1
  • npm -- 5.7.1

Workaround

Obviously this can be worked around in Batavia, but I thought it enough of an issue to raise since the obvious workarounds would only work in Batavia with this bug, not in CPython nor Batavia without this bug.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions