checking if a list is empty

Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at spamschutz.glglgl.de
Sun May 22 16:41:34 EDT 2011


Am 11.05.2011 23:02 schrieb Ian:

> On 11/05/2011 20:13, Hans Georg Schaathun wrote:
>>  Lists do not have truth values in the
>> application domain, and therefore truth values in the
>> implementation domain is complicated.
>>
> Exactly. Its just a convention. If it exists, its true, if if doesn't
> its false.

Right. And not only that: Python objects resp. classes not claiming to 
have a truth value (__nonzero__), but a length (__len__) are judged by 
that concerning their truth value: iff the length is 0, their truth 
value is False.


Thomas



More information about the Python-list mailing list