DRY is not the only principle to consider here.

On Sunday, February 24, 2013, Chris Angelico wrote:
On Mon, Feb 25, 2013 at 1:16 AM, Steven D'Aprano <steve@pearwood.info> wrote:
> On 24/02/13 23:59, Chris Angelico wrote:
>>
>> On Sun, Feb 24, 2013 at 10:25 PM, Larry Hastings <larry@hastings.org>
>> wrote:
>>>
>>> Or
>>>
>>>      command, subcommand = next(iterargs), next(iterargs)
>>
>>
>> Err.... is there a language guarantee of the order of evaluation in a
>> tuple, or is this just a "CPython happens to evaluate independent
>> expressions left-to-right"? This is totally broken if the next() calls
>> could be done in either order.
>
> It's a language guarantee.
>
> http://docs.python.org/2/reference/expressions.html#evaluation-order

Ah, so it is. My bad, sorry! In that case, sure, this works. It still
violates DRY though, naming the iterable twice and relying on the
reader noticing that that means "take two off this one". But that's a
much weaker concern.

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas


--
--Guido van Rossum (python.org/~guido)