Brilliant or insane code?
Robin Becker
robin at reportlab.com
Wed Mar 18 11:28:00 EDT 2015
On 18/03/2015 00:35, Mark Lawrence 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.
>
There was a long thread on an inverse problem (2d only interleave separate lists
of x & y coordinates) in clp some while ago
https://groups.google.com/forum/#!topic/comp.lang.python/ODqrLDRn61k
the winner at that time was was Peter Otten with
> def flatten7(x,y):
> '''Peter Otten special case equal lengths'''
> n = len(x)
> assert len(y) == n
> result = [None] * (2*n)
> result[::2] = x
> result[1::2] = y
> return result
interestingly whilst many of the other solutions can be improved/modernized in
later pythons this one has stayed the same.
--
Robin Becker
More information about the Python-list
mailing list