Can't define __call__ within __init__?

MRAB python at mrabarnett.plus.com
Thu Mar 11 11:01:41 EST 2010


Andre Engels wrote:
> On Thu, Mar 11, 2010 at 2:30 PM, Steve Holden <steve at holdenweb.com> wrote:
> 
>>> The example I showed was just a toy problem.  The real problem is
>>> I expect to call a function many times, and I want to avoid the overhead of
>>> the 'if blah' everytime.
>>>
>> This is a premature optimization. First, make it work. Then (if it
>> doesn't work fast enough) make it work faster.
> 
> Corrolary: When you do make it faster, make it faster where it is slow.
> Second corrolary: If making it fast is so important that these two
> rules do not apply, Python is not your language of choice.
> 
Addendum: a bad algorithm is bad, whatever language it's written in.



More information about the Python-list mailing list