while expression feature proposal
Devin Jeanpierre
jeanpierreda at gmail.com
Fri Oct 26 19:51:21 EDT 2012
On Fri, Oct 26, 2012 at 7:41 PM, Dan Loewenherz <dloewenherz at gmail.com> wrote:
-- snip insanity --
>
> But this is yucky. I'd much rather have something a bit more clear to the
> reader.
That's why I said I wanted a better iter, not some equality-overriding
object strawman thing.
I was thinking more like this:
for profile_id in iter(None)(client.spop, "profile_ids"):
or alternatively:
for profile_id in iter(bool)(client.spop, "profile_ids"):
Or perhaps either as keyword arguments (which is the only reason I
curried iter).
The interesting case for in-place assignment is not here. This is a
trivial case. It's in cases like this:
while True:
x = foo(bar())
if x is None: break
if x % 2 == 0: break
print x
Imagine doing that with iter. :)
-- Devin
More information about the Python-list
mailing list