Brilliant or insane code?

Dan Sommers dan at tombstonezero.net
Tue Mar 17 23:06:38 EDT 2015


On Wed, 18 Mar 2015 13:25:45 +1100, Steven D'Aprano wrote:

> On Wednesday 18 March 2015 12:14, Dan Sommers wrote:

>> According to the article itself, "it relies in an implementation
>> detail (the order the zip function iterates over the arrays) to
>> work."  Then again, the article also points to the official docs that
>> says that this implementation detail is guaranteed.

> That means it isn't an implementation detail, it's interface ...

Agreed.  I only called it an implementation detail to preserve (or to
create) continuity.

> "This relies on an implementation detail that len() of a list returns
> the number of items of the list. P.S. the documentation guarantees
> that len() of a list will return the number of items of the list."

> The technique being used neither brilliant nor insane ...

Insightful?

Idiomatic?

Pythonic?

It's certainly fairly obvious once you've seen it.



More information about the Python-list mailing list