[Python-Dev] Re: Empty keyword
sh at defuze.org
Mon Jun 7 17:36:28 EDT 2004
It still doesn't make sense to me as I don't see why the fact a list is
empty means that it can be stated as false.
Intuitively it doesn't sound correct to me as there is no logical link
between the truth of an object and the fact that it can be empty.
What I mean, is that usually I find Python to be really logical and
clear, but there I think it is misleading.
You're gonna say "nah you're stupid, it is easy"... certainly when you
are used to it, it sounds ok but it doesn't IMO.
Casey Duncan wrote:
> On Mon, 07 Jun 2004 14:32:18 +0100
> Sylvain Hellegouarch <sh at defuze.org> wrote:
>>It miht sound stupid or useless, or maybe someone has already
>>mentioned it but sometimes I wish Python could provdie an "Empty"
>>keyword like The "None" one.
>>It would be usefull to validdate the emptyness of any scalar or
>>sequence in an uniform way instead of using things such as :
>>if len(mylist) == 0:
> You would not write it this way anyhow. In Python you can test a
> sequence directly as in:
> if mylist:
> if not mylist:
> Empty sequences (and mappings) are false and non-empty sequences are
> See also: http://docs.python.org/ref/Booleans.html#Booleans
> Python-Dev mailing list
> Python-Dev at python.org
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org
More information about the Python-Dev