Listbox fill=BOTH expand=YES (Tkinter)

Raseliarison nirinA nirina at
Thu Mar 17 22:23:34 CET 2005

"Christos TZOTZIOY Georgiou" wrote:
> the 'in' operator searches for existance of *elements* in a set, not
> of *subsets*.  BTW, only a frozenset can be included in a set.

ah! yes. that's clear now. thanks!
after all:

>>> for element in aset:
          print element,

why did i think that 'in' was another different operator?
the test should be then:

>>> 'TRUE' in dir(Tkconstants) and 'YES' in dir(Tkconstants)

and then:

>>> 'inexistent keyword' in dir(Tkconstants) and 'YES' in

a bit cumbersome if there is a lot of keys to test.
i also found in the itertools-recipes the way to avoid
the reduce-lambda construction i had previously in head:

>>> from itertools import *
>>> def all(seq, pred=bool):
            "Returns True if pred(x) is True for every element in the
            for elem in ifilterfalse(pred, seq):
                    return False
            return True

>>> all(i in dir(Tkconstants) for i in ['TRUE', 'YES'])
>>> all(i in dir(Tkconstants) for i in ['TRUE', 'YES', 'inexistent

i do not regret the fate of reduce et al.

> To check for subsets, either use the issubset function, or the '<'
operator (I
> believe they both call the same code):
> .>> set(['TRUE','YES']).issubset(set(dir(Tkconstants)))
> True
> can be expressed as
> .>> set(['TRUE','YES']) < set(dir(Tkconstants))
> True

i noted! thanks again.


More information about the Python-list mailing list