"0 in [True,False]" returns True

Fredrik Lundh fredrik at pythonware.com
Tue Dec 13 05:53:59 EST 2005


Duncan Booth wrote:
>
> > For HTML attributes that don't have an explicit value (such as the
> > SELECTED attribute in OPTION) the keyword argument to the function must
> > have the value True
>
> 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.

footnote: strictly speaking, minimized attributes have values but no names;
it's up to the parser to determine what attribute you're setting when you
specify the value.

(for example, in <img ismap>, "ismap" is the value, not the attribute name.
it's up to the parser to figure out (from the DTD) that this value can only
be used by the "ismap" attribute, and interpret it as <img ismap=ismap>)

</F>






More information about the Python-list mailing list