Re: while expression feature proposal

2012-10-26 Thread Dan Loewenherz
On Fri, Oct 26, 2012 at 4:12 PM, Devin Jeanpierre wrote: > > For loops are pythonic. You can do this in Python today: > > client = StrictRedis() > for profile_id in iter(lambda: client.spop("profile_ids"), None): > pass > > I would like a better iter(), rather than a better while l

Re: while expression feature proposal

2012-10-26 Thread Dan Loewenherz
On Thursday, October 25, 2012 11:06:01 PM UTC-7, Paul Rubin wrote: > Dan Loewenherz writes: > > > In this case, profile_id is "None" when the loop breaks. It would be > > > much more straightforward (and more Pythonic, IMO), to write: > > > > >

Re: while expression feature proposal

2012-10-25 Thread Dan Loewenherz
It seems the topic of this thread has changed drastically from the original message. 1) "while EXPR as VAR" in no way says that EXPR must be a boolean value. In fact, a use case I've run into commonly in web development is popping from a redis set. E.g. client = StrictRedis() while Tru

while expression feature proposal

2012-10-24 Thread Dan Loewenherz
Hi all, This is my first post to this group--I'm not subscribed, so please CC me in responses. So I'm sure a lot of you have run into the following pattern. I use it all the time and it always has felt a bit awkward due to the duplicate variable assignment. VAR = EXPR while VAR: BLOCK VA