Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
5ed8f324
Commit
5ed8f324
authored
May 16, 2018
by
Martin Reinecke
Browse files
disallow implicit conversion of Field to boolean
parent
1e05a9ee
Pipeline
#29345
passed with stages
in 12 minutes and 22 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
nifty4/field.py
View file @
5ed8f324
...
...
@@ -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.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment