Reference
Roy Smith
roy at panix.com
Tue Mar 4 11:14:13 EST 2014
In article <mailman.7726.1393948954.18130.python-list at python.org>,
Chris Angelico <rosuav at gmail.com> wrote:
> On Wed, Mar 5, 2014 at 2:42 AM, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> wrote:
> > # I never know when to stop
> > if bool(flag) is True is True is True is True is True is True: ...
>
> The banana problem.
>
> ChrisA
You can refactor that as:
eval(" is ".join(itertools.chain(["if bool(flag)"], [str(t) for t in
itertools.repeat(True)])))
More information about the Python-list
mailing list