Re: [Tutor] Problem with if statements and else statements

2017-05-30 Thread Cameron Simpson
On 30May2017 12:06, Peter Otten <__pete...@web.de> wrote: Cameron Simpson wrote: As written it should be a bit slower: to construct a set each member get tested for presence. The cost is in making the set, not in searching it. No, CPython is a bit smarter than that: dis.dis('if m in {"1", "J

Re: [Tutor] Problem with if statements and else statements

2017-05-30 Thread Peter Otten
Cameron Simpson wrote: > On 29May2017 01:17, Alan Gauld wrote: >>On 29/05/17 00:12, Alex Kleider wrote: >>> Would >> if Month in {'January', '1'}: >>> >>> be even better? (regarding efficiency perhaps? Trivial point, I know, >>> but just wondering.) >> >>If in doubt try it out and profile/ti