Python variables are bound to types when used?

Grant Edwards grante at visi.com
Wed Oct 19 16:12:52 EDT 2005


On 2005-10-19, Grant Edwards <grante at visi.com> wrote:

>> So, if I use "l2" thus:
>>
>> if (l2): # only then does it make it a boolean?
>
> That doesn't affect the type of the object with the name "l2"
> at all.  It checks to see if l2 has a false value or not.
> Examples of basic objects with false values are an iteger 0, a
> floating point 0.0, an empty string "", an empty list [], an
> empty tuple (), or an empty dictionary {}.

Oh, and a bool False, obviously.

-- 
Grant Edwards                   grante             Yow!  It's so OBVIOUS!!
                                  at               
                               visi.com            



More information about the Python-list mailing list