Fix in keyword with Spaces (#1261)

Binding `__contains__` to the Space class' contains method this way prevents overriding it in subclasses, which leads to `NotImplementedException`s when trying to do things like `2 in gym.spaces.Discrete(2)`.
This commit is contained in:
Balázs Kossovics
2019-01-28 23:52:41 +01:00
committed by pzhokhov
parent 12e8b763d5
commit e8349e3668

View File

@@ -215,7 +215,8 @@ class Space(object):
"""
raise NotImplementedError
__contains__ = contains
def __contains__(self, x):
return self.contains(x)
def to_jsonable(self, sample_n):
"""Convert a batch of samples from this space to a JSONable data type."""