"Christos TZOTZIOY Georgiou" wrote: > On Tue, 15 Mar 2005 16:48:17 +0300, > rumours say that [i] might have written: > > >yes, indeed. > >>>> import Tkconstants > >>>> 'True' and 'YES' in dir(Tkconstants) > >True > > > >thanks Harlin, > > I hope you also know that > > .>> 'inexistent keyword' and 'YES' in dir(Tkconstants) > > is also True...
yeah, known but forgotten. hmmm ....... let's try : >>> import Tkconstants >>> 'YES' in dir(Tkconstants) True >>> 'True' in dir(Tkconstants) False >>> 'TRUE' in dir(Tkconstants) True >>> ('inexistent keyword') in dir(Tkconstants) False so >>> 'TRUE' and 'YES' in dir(Tkconstants) True >>> 'inexistent keyword' and 'YES' in dir(Tkconstants) True i'll recite 42 times truth tables before going to bed. however i didn't expect the following: >>> 'inexistent keyword' or 'YES' in dir(Tkconstants) 'inexistent keyword' >>> False or 'YES' in dir(Tkconstants) True hmmm... >>> ('inexistent keyword' or 'YES') in dir(Tkconstants) False >>> (False or 'YES') in dir(Tkconstants) True i'll recite 42 times precedence rules before going to bed. but now i'm a bit confused by the -in- operator. as: >>> set(['TRUE','YES']).issubset(set(dir(Tkconstants))) True i expected this to be true, but it's not: >>> set(['TRUE','YES']) in set(dir(Tkconstants)) False originaly, i'm thinking to short-cut the following, >>> reduce(lambda t,f: t and f, [i in dir(Tkconstants) for i in 'YES','inexistent keyword']) False >>> reduce(lambda t,f: t and f, [i in dir(Tkconstants) for i in 'TRUE','YES']) True but that was too short and i miss something! i do reset my brain somewhere between cell234 and cell241 thanks for reading! -- nirinA -- -- http://mail.python.org/mailman/listinfo/python-list