Something or Nothing^H^H^H^H^H^H^HEmpty
Anders J. Munch
andersjm at dancontrol.dk
Thu Apr 11 08:00:26 EDT 2002
"Magnus Lie Hetland" <mlh at vier.idi.ntnu.no> wrote in message
news:slrnab9s50.6g8.mlh at vier.idi.ntnu.no...
> In article <3cb3fbc0$0$78808$edfadb0f at dspool01.news.tele.dk>, Anders
> J. Munch wrote:
> >Pythons truth values are not "Something or Nothing". The phrase seems
> >to have caught on following Laura's post, but I believe it is
> >misleading.
>
> I don't.
>
> >[] and {} are objects,
>
> Yes, as are None and 0.
The important part is that they are _mutable_ objects. The identity of each
instance is by itself important information.
>
> > they are objects with identity, and they are
> >mutable objects. They are empty, but they are by no means "nothing".
>
> Would you call them false? Would you call 0 empty? It's an intuitive
> way of explaining the concept, not a precise one.
With true~something and false~nothing, "if history:" in my example asks if
something was passed for the optional argument. I'd call that intuitive.
Intuitively my function is correct as written. Hence true~something and
false~nothing guides my intuition poorly.
And no, I wouldn't call 0 empty, although there is a reasonable association
in that 0 is the cardinality of an empty container. I would call this stuff
"considered false" or "treated as false in Python".
As for intuitive ways of explaining concepts: Examples, examples, examples.
Accept no substitute.
and-that-goes-for-newsgroup-postings-too-ly-y'rs, Anders
More information about the Python-list
mailing list