Implicit conversion to boolean in if and while statements

Chris Angelico rosuav at gmail.com
Mon Feb 11 08:52:24 EST 2013


On Tue, Feb 12, 2013 at 12:28 AM, Rick Johnson
<rantingrickjohnson at gmail.com> wrote:
> I am sure there are quite a few Chris. But if you expect to around making statements like: "Python does not have typed arrays", then don't get all upset when someone corrects you.

Oh, I don't mind being corrected on those sorts of points. And if ever
I say "Python doesn't have a module for creating a DNS server", I will
be quite happy to be corrected, because DNS servers are fun.

But my statement wasn't based on my own knowledge of the stdlib, but
rather on this:

On Sat, Feb 9, 2013 at 6:58 AM, Rick Johnson
<rantingrickjohnson at gmail.com> wrote:
> I'm a bit unnerved by the sum function. Summing a sequence only makes sense if the sequence in question contains /only/ numeric types. For that reason i decided to create a special type for holding Numerics.

Why create a special type if it already exists?

> Maybe, before you go and pop your mouth off next time, if it isn't too much trouble, i mean, i don't want you to get a cramp in your wrist or a blister on your finger, much less a headache reading a few lines of documentation, but if is not too much to ask, "Mr. Angelico", i would suggest you stuff this tiny little code snippet into your favorite Python interpreter and run it!
>
> py> help('modules')
>
> See, some python functions are useful.

Yep. By the way, how does the help function fit into your wonderfully
OOP model? What's it a method on?

ChrisA



More information about the Python-list mailing list