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

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to