"0 in [True,False]" returns True

Fredrik Lundh fredrik at pythonware.com
Tue Dec 13 06:21:32 EST 2005


Duncan Booth wrote:

> A better way to do this (given that HTML defines exactly which attributes
> do not take a value) is to use the attribute name and simply generate the
> attribute only if the value is non-false.

another approach (which may or may not be suitable in this case) is to
use the presence of an attribute in the dictionary as an indication that
it should be included in the file, and use the special value None to mean
that it should be minimized.

yet another approach is to use an existing HTML serialization library, and
do whatever they do.

</F>






More information about the Python-list mailing list