Re: Comments merging, pass 2
Blake Winton <blake-dlUKtbW3TlBcVw/[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.devel |
|---|---|
| Message-ID | <[email protected]> |
Various people wrote: > Logically, though, "return (a and [b] or [c])[0]" has to be one > dictionary allocation larger than > > if a: return b > else: return c Not if the list is lazily evaluated (as it indeed is in Python). Both cases evaluate a. If a is false, then a and [b] has to be false, so [b] doesn't even get constructed, and it skips to the "or [c]". On the other hand, if a is true, then "a and [b]" will be true, so [c] doesn't get evaluated, since true or anything is still true. Later, Blake. ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/