On Tue, Aug 22, 2017 at 11:04 AM, Michael Lamparski <
[email protected]> wrote:
> I think truthiness is easily a wart in any dynamically-typed language (and
> yet ironically, every language I can think of that has truthiness is
> dynamically typed except for C++). And yet for some reason it seems to be
> pressed forward as idiomatic in python, and for that reason alone, I use
> it.
>
me too :-)
> Meanwhile, for an arbitrary iterator taken as an argument, if you want it
> to have at least one element for some reason, then good luck; truthiness
> will not help you.
>
of course, nor will len()
And this is mostly OK, as if you are taking an aritrary iterable, then you
are probably going to, well, iterate over it, and:
for this in an_empty_iterable:
...
works fine.
But bringing it back OT -- it's all a bit messy, but there is logic for
the existing conventions in numpy -- and I think backward compatibility is
more important than a slightly cleaner API.
-CHB
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
[email protected]
_______________________________________________
NumPy-Discussion mailing list
[email protected]
https://mail.python.org/mailman/listinfo/numpy-discussion