how to find not the next sibling but the 2nd sibling or findsibling "a" OR sinbling "b"
Brett Hoerner
bretthoerner at gmail.com
Thu Jan 19 20:02:11 EST 2006
localpricemaps at gmail.com wrote:
> hey fredrik,
>
> i don't understand what you are saying
Do what he showed in the Python interactive shell,
> Fredrik Lundh wrote:
> > 'food' or 'drink' doesn't do what you think it does:
> >
> > >>> 'food' or 'drink'
> > 'food'
> >
> > >>> {'class': 'food' or 'drink'}
> > {'class': 'food'}
"or" returns the first true element, anything but False or None, I
think... so 'food' (a string) is true, and always will return in that
code.
http://diveintopython.org/power_of_introspection/and_or.html
Brett
More information about the Python-list
mailing list