File tree 4 files changed +8
-0
lines changed
4 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,8 @@ function init_jlwrap_any()
206
206
return ValueBase.__dir__(self) + self._jl_callmethod($(pyjl_methodnum (pyjlany_dir)) )
207
207
def __call__(self, *args, **kwargs):
208
208
return self._jl_callmethod($(pyjl_methodnum (pyjlany_call)) , args, kwargs)
209
+ def __bool__(self):
210
+ return True
209
211
def __len__(self):
210
212
return self._jl_callmethod($(pyjl_methodnum (pyjlany_op (length))) )
211
213
def __getitem__(self, k):
Original file line number Diff line number Diff line change @@ -304,6 +304,8 @@ function init_jlwrap_array()
304
304
return self._jl_callmethod($(pyjl_methodnum (Py ∘ copy)) )
305
305
def reshape(self, shape):
306
306
return self._jl_callmethod($(pyjl_methodnum (pyjlarray_reshape)) , shape)
307
+ def __bool__(self):
308
+ return bool(len(self))
307
309
def __getitem__(self, k):
308
310
return self._jl_callmethod($(pyjl_methodnum (pyjlarray_getitem)) , k)
309
311
def __setitem__(self, k, v):
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ function init_jlwrap_dict()
38
38
class DictValue(AnyValue):
39
39
__slots__ = ()
40
40
_jl_undefined_ = object()
41
+ def __bool__(self):
42
+ return bool(len(self))
41
43
def __iter__(self):
42
44
return self._jl_callmethod($(pyjl_methodnum (pyjldict_iter)) )
43
45
def __contains__(self, key):
Original file line number Diff line number Diff line change @@ -79,6 +79,8 @@ function init_jlwrap_set()
79
79
$(" \n " ^ (@__LINE__ ()- 1 ))
80
80
class SetValue(AnyValue):
81
81
__slots__ = ()
82
+ def __bool__(self):
83
+ return bool(len(self))
82
84
def add(self, value):
83
85
return self._jl_callmethod($(pyjl_methodnum (pyjlset_add)) , value)
84
86
def discard(self, value):
You can’t perform that action at this time.
0 commit comments