On Fri, Jan 27, 2012 at 1:29 PM, Robert Kern robert.k...@gmail.com wrote:
Well, if you really need to do this in more than one place, define a
utility function and call it a day.
def should_not_plot(x):
if x is None:
return True
elif isinstance(x, np.ndarray):
return
I have been using numpy for several years and I am very impressed with its
flexibility. However, there is one problem that has always bothered me.
Quite often I need to test consistently whether a variable is any of the
following: an empty list, an empty array or None. Since both arrays and
On Fri, Jan 27, 2012 at 2:46 PM, Bartosz Telenczuk
b.telenc...@biologie.hu-berlin.de wrote:
I have been using numpy for several years and I am very impressed with its
flexibility. However, there is one problem that has always bothered me.
Quite often I need to test consistently whether a
On Fri, Jan 27, 2012 at 20:46, Bartosz Telenczuk
b.telenc...@biologie.hu-berlin.de wrote:
I have been using numpy for several years and I am very impressed with its
flexibility. However, there is one problem that has always bothered me.
Quite often I need to test consistently whether a
Thank you for your tips. I was not aware of the possible problems with len.
There is no way to test all of the cases (empty sequence, empty array,
None) in the same way. Usually, it's a bad idea to conflate the three.
I agree that this should be avoided. However, there are cases in which it is