On Fri, Jan 27, 2012 at 1:29 PM, Robert Kern 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 x.size == 0
>
This will be indeed very helpful. Thanks.
> 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 x.size == 0
>else:
>
On Fri, Jan 27, 2012 at 21:24, Bartosz Telenczuk
wrote:
> 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 th
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 i
On Fri, Jan 27, 2012 at 20:46, Bartosz Telenczuk
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 variable is any of the
> following:
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
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 list