Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #87685
| From | Robin Becker <robin@reportlab.com> |
|---|---|
| Subject | Re: Brilliant or insane code? |
| Date | 2015-03-18 15:28 +0000 |
| References | <meah8u$odg$1@ger.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5.1426692496.10327.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Brilliant or insane code? Robin Becker <robin@reportlab.com> - 2015-03-18 15:28 +0000
csiph-web