expression in an if statement

John Nagle nagle at animats.com
Wed Aug 18 23:14:15 CEST 2010


On 8/18/2010 11:24 AM, ernest wrote:
> Hi,
>
> In this code:
>
> if set(a).union(b) == set(a): pass
>
> Does Python compute set(a) twice?

    CPython does.  Shed Skin might optimize.  Don't know
about Iron Python.

					John Nagle



More information about the Python-list mailing list