Nick the Gr33k <supp...@superhost.gr> writes: > On 15/6/2013 3:14 πμ, Cameron Simpson wrote: >> But for what you are doing, "and" and "or" are not good operations. >> >> Something like: >> >> "k" in (name+month+year) >> >> or >> >> "k" in name or "k" in month or "k" in year > > Used to wrote it myself like the latter but needed a more compact way > of writing it for clarity so i used the former. > > but those 2 gives the same results back > > "k" in (name+month+year) == "k" in (name and month and year) > True > > so both seem to work as expected.
That happens only by chance: it seems you now understand the evaluation of "boolean" expressions in Python, so the following should be clear to you: >>> "k" in ("there" + "is" + "a" + "k" + "character" + "somewhere") True >>> "k" in ("there" and "is" and "a" and "k" and "character" and "somewhere") False ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapensiero.it | -- Fortunato Depero, 1929. -- http://mail.python.org/mailman/listinfo/python-list