Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #87685 > unrolled thread

Re: Brilliant or insane code?

Started byRobin Becker <robin@reportlab.com>
First post2015-03-18 15:28 +0000
Last post2015-03-18 15:28 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Brilliant or insane code? Robin Becker <robin@reportlab.com> - 2015-03-18 15:28 +0000

#87685 — Re: Brilliant or insane code?

FromRobin Becker <robin@reportlab.com>
Date2015-03-18 15:28 +0000
SubjectRe: Brilliant or insane code?
Message-ID<mailman.5.1426692496.10327.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web