Brilliant or insane code?

Chris Angelico rosuav at gmail.com
Tue Mar 17 21:11:23 EDT 2015


On Wed, Mar 18, 2015 at 11:35 AM, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> I've just come across this
> http://www.stavros.io/posts/brilliant-or-insane-code/ as a result of this
> http://bugs.python.org/issue23695
>
> Any and all opinions welcomed, I'm chickening out and sitting firmly on the
> fence.

"""I don’t really like the fact that it relies in an implementation
detail (the order the zip function iterates over the arrays) to
work"""

I don't think that's an implementation detail. Since zip is designed
to work with arbitrary iterables, it needs to be able to cope with
those which interact with each other. The most obvious order for it to
grab values is the order it was given them, and that's exactly what it
does. If that's not specifically documented, it should be, because
this won't be the only code that depends on it.

ChrisA



More information about the Python-list mailing list