Coolest Python recipe of all time

Stefan Behnel stefan_ml at behnel.de
Tue May 3 01:04:47 EDT 2011


David Monaghan, 02.05.2011 23:45:
> On Mon, 2 May 2011 14:58:50 -0600, Ian Kelly wrote:
>
>> On Mon, May 2, 2011 at 2:48 PM, David Monaghan wrote:
>>> On Mon, 2 May 2011 10:33:31 -0700 (PDT), Raymond Hettinger wrote:
>>>
>>>> I think it is time to give some visibility to some of the instructive
>>>> and very cool recipes in ActiveState's python cookbook.
>>>>
>>>> My vote for the coolest recipe of all time is:
>>>>
>>>>     http://code.activestate.com/recipes/365013-linear-equations-solver-in-3-lines/
>>>
>>> Really cool, but wrong. x = 3234.667, not 3236.0
>>
>> Nope, I get 3236.  Maybe you made a mistake somewhere.
>
> Oops. What a plonker .Three times I checked and got the same result each
> time. Now it works fine. Sorry!

The bad thing about this recipe is that it requires quite a bit of 
background knowledge in order to infer that the code the developer is 
looking at is actually correct. At first sight, it looks like an evil hack, 
and the lack of documentation doesn't help either.

Stefan




More information about the Python-list mailing list