提交 4d696af3 authored 作者: Julien Rebetez's avatar Julien Rebetez

Add __contains__ operator to optdb.DB

上级 6ca7b2b6
...@@ -160,6 +160,9 @@ multiple time in a DB. Tryed to register "%s" again under the new name "%s". ...@@ -160,6 +160,9 @@ multiple time in a DB. Tryed to register "%s" again under the new name "%s".
for variable in variables: for variable in variables:
return variable return variable
def __contains__(self, name):
return name in self.__db__
def print_summary(self, stream=sys.stdout): def print_summary(self, stream=sys.stdout):
print("%s (id %i)" % (self.__class__.__name__, id(self)), file=stream) print("%s (id %i)" % (self.__class__.__name__, id(self)), file=stream)
print(" names", self._names, file=stream) print(" names", self._names, file=stream)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论