Skip to content
Snippets Groups Projects
Commit 5ed8f324 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

disallow implicit conversion of Field to boolean

parent 1e05a9ee
Branches
Tags
No related merge requests found
Pipeline #
......@@ -79,6 +79,13 @@ class Field(object):
if locked:
dobj.lock(self._val)
# prevent implicit conversion to bool
def __nonzero__(self):
raise TypeError("Field does not support implicit conversion to bool")
def __bool__(self):
raise TypeError("Field does not support implicit conversion to bool")
@staticmethod
def full(domain, val, dtype=None):
"""Creates a Field with a given domain, filled with a constant value.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment