Home

Skip Montanaro a écrit :
>>> In this case there was a bug. Depending on inputs, sometimes obj
>>> initialized to a class, sometimes an instance of that class. (I fixed
>>> that too while I was at it.) The problem was that the use of __call__
>>> obscured the underlying bug by making the instance as well as the class
>>> callable.
>
>> I don't quite get the point here. A concrete example would be welcome.
>
> The bug went something like this:
>
> obj = some.default_class
> ...
> if some_other_rare_condition_met:
> ... several lines ...
> obj = some.other_class()
> ...
>
> Later,
>
> x = obj()
> x(...)

Ok, I see. A nasty one, indeed.

previous
next

Re: beginner whitespace question
Re: A few questions on C++
the address of list.append and list.append.__doc__
Re: Replacing overloaded functions with closures.
Re: Python and Tkinter Programming--Expensive!
Fundacja Iskierka
Fundacja Hobbit
Pajacyk
Nasze Dzieci
Rodzic Po Ludzku