[Python-ideas] iterable.__unpack__ method
Vito De Tullio
vito.detullio at gmail.com
Sun Feb 24 16:45:16 CET 2013
Chris Angelico wrote:
>>>> command, subcommand = next(iterargs), next(iterargs)
> 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".
well, about the DRY it's the same, but I found the "old stupid"
command = next(iterargs)
subcommand = next(iterargs)
mostly more explicit in the "take two off this one"
maybe it's... too much explicit (and it's not a single expression!!!
anathema!) but I found slightly more readable
--
ZeD
More information about the Python-ideas
mailing list