Re: Stupid ways to spell simple code

2013-07-10 Thread Joshua Landau
On 30 June 2013 07:06, Chris Angelico wrote: > So, here's a challenge: Come up with something really simple, and > write an insanely complicated - yet perfectly valid - way to achieve > the same thing. Bonus points for horribly abusing Python's clean > syntax in the process. This occurred to me o

Re: Stupid ways to spell simple code

2013-07-02 Thread Russel Walker
On Sunday, June 30, 2013 8:06:35 AM UTC+2, Chris Angelico wrote: > There's a bit of a discussion on python-ideas that includes a function > > that raises StopIteration. It inspired me to do something stupid, just > > to see how easily I could do it... > > > > On Sun, Jun 30, 2013 at 3:45 PM, N

Re: Stupid ways to spell simple code

2013-07-02 Thread Chris Angelico
On Tue, Jul 2, 2013 at 2:30 AM, Joshua Landau wrote: > Beautiful, see? Truly a work of art! I am awed. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Stupid ways to spell simple code

2013-07-01 Thread Marcin Szamotulski
On 22:09 Mon 01 Jul , Steven D'Aprano wrote: > On Mon, 01 Jul 2013 20:36:29 +0100, Marcin Szamotulski wrote: > > > Here is another example which I came across when playing with > > generators, the first function is actually quite useful, the second > > generator is the whole fun: > > > > from

Re: Stupid ways to spell simple code

2013-07-01 Thread 88888 Dihedral
Steven D'Aprano於 2013年7月2日星期二UTC+8上午6時09分18秒寫道: > On Mon, 01 Jul 2013 20:36:29 +0100, Marcin Szamotulski wrote: > > > > > Here is another example which I came across when playing with > > > generators, the first function is actually quite useful, the second > > > generator is the whole fun: >

Re: Stupid ways to spell simple code

2013-07-01 Thread Steven D'Aprano
On Mon, 01 Jul 2013 20:36:29 +0100, Marcin Szamotulski wrote: > Here is another example which I came across when playing with > generators, the first function is actually quite useful, the second > generator is the whole fun: > > from functools import wraps > def init(func): > """decorator wh

Re: Stupid ways to spell simple code

2013-07-01 Thread Marcin Szamotulski
On 17:30 Mon 01 Jul , Joshua Landau wrote: > On 1 July 2013 14:14, Chris Angelico wrote: > > On Mon, Jul 1, 2013 at 10:59 PM, Neil Cerutti wrote: > >> On 2013-06-30, Chris Angelico wrote: > >>> So, here's a challenge: Come up with something really simple, > >>> and write an insanely complica

Re: Stupid ways to spell simple code

2013-07-01 Thread Joshua Landau
On 1 July 2013 14:14, Chris Angelico wrote: > On Mon, Jul 1, 2013 at 10:59 PM, Neil Cerutti wrote: >> On 2013-06-30, Chris Angelico wrote: >>> So, here's a challenge: Come up with something really simple, >>> and write an insanely complicated - yet perfectly valid - way >>> to achieve the same t

Re: Stupid ways to spell simple code

2013-07-01 Thread Chris Angelico
On Mon, Jul 1, 2013 at 10:59 PM, Neil Cerutti wrote: > On 2013-06-30, Chris Angelico wrote: >> So, here's a challenge: Come up with something really simple, >> and write an insanely complicated - yet perfectly valid - way >> to achieve the same thing. Bonus points for horribly abusing >> Python's

Re: Stupid ways to spell simple code

2013-07-01 Thread Neil Cerutti
On 2013-06-30, Chris Angelico wrote: > So, here's a challenge: Come up with something really simple, > and write an insanely complicated - yet perfectly valid - way > to achieve the same thing. Bonus points for horribly abusing > Python's clean syntax in the process. > > Go on, do your worst! I'v

Re: Stupid ways to spell simple code

2013-06-30 Thread Joshua Landau
On 30 June 2013 18:36, Steven D'Aprano wrote: > Pfft! Where's the challenge in that? Let's use an O(n!) algorithm for > sorting -- yes, n factorial -- AND abuse a generator expression for its > side effect. As a bonus, we use itertools, and just for the lulz, I > obfuscate as many of the names as

Re: Stupid ways to spell simple code

2013-06-30 Thread Roy Smith
In article <51d06cb6$0$2$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Sun, 30 Jun 2013 16:06:35 +1000, Chris Angelico wrote: > > > So, here's a challenge: Come up with something really simple, and write > > an insanely complicated - yet perfectly valid - way to achieve t

Re: Stupid ways to spell simple code

2013-06-30 Thread Steven D'Aprano
On Sun, 30 Jun 2013 16:06:35 +1000, Chris Angelico wrote: > So, here's a challenge: Come up with something really simple, and write > an insanely complicated - yet perfectly valid - way to achieve the same > thing. Bonus points for horribly abusing Python's clean syntax in the > process. Here's a

Re: Stupid ways to spell simple code

2013-06-30 Thread Ian Kelly
On Sun, Jun 30, 2013 at 9:20 AM, Chris Angelico wrote: > Yeah, I cannot seriously imagine that the stdlib does anything like > the example I gave :) Pity nobody else is offering further examples, I > thought this might be a fun thread. Well, there is the "this" module. But its code is not *that*

Re: Stupid ways to spell simple code

2013-06-30 Thread Chris Angelico
On Mon, Jul 1, 2013 at 1:08 AM, Joshua Landau wrote: > On 30 June 2013 15:58, Rick Johnson wrote: >> Chris, i'm sorry, but your challenge is decades too late. If you seek >> amusement you need look no further than the Python stdlib. If you REALLY >> want to be amused, peruse the "idlelib" -- no

Re: Stupid ways to spell simple code

2013-06-30 Thread Joshua Landau
On 30 June 2013 15:58, Rick Johnson wrote: > Chris, i'm sorry, but your challenge is decades too late. If you seek > amusement you need look no further than the Python stdlib. If you REALLY want > to be amused, peruse the "idlelib" -- not only is the code obfuscated, it > also breaks PEP8 and t

Re: Stupid ways to spell simple code

2013-06-30 Thread Rick Johnson
On Sunday, June 30, 2013 1:06:35 AM UTC-5, Chris Angelico wrote: > So, here's a challenge: Come up with something really simple, and > write an insanely complicated - yet perfectly valid - way to achieve > the same thing. Bonus points for horribly abusing Python's clean > syntax in the process. Ch

Re: Stupid ways to spell simple code

2013-06-30 Thread Cameron Simpson
On 30Jun2013 16:06, Chris Angelico wrote: | So, here's a challenge: Come up with something really simple, and | write an insanely complicated - yet perfectly valid - way to achieve | the same thing. Bonus points for horribly abusing Python's clean | syntax in the process. _Must_ you turn this int

Re: Stupid ways to spell simple code

2013-06-29 Thread Joshua Landau
On 30 June 2013 07:06, Chris Angelico wrote: > There's a bit of a discussion on python-ideas that includes a function > that raises StopIteration. It inspired me to do something stupid, just > to see how easily I could do it... > > On Sun, Jun 30, 2013 at 3:45 PM, Nick Coghlan wrote: > Re: [Pytho