Hooks (Re: What does Python fix?)

Pedro Rodriguez pedro_rodriguez at club-internet.fr
Tue Jan 22 05:07:33 EST 2002


"hungjunglu" <hungjunglu at yahoo.com> wrote:

> --- In python-list at y..., "Andrew Dalke" <dalke at d...> wrote:
>> I believe you refer to modifing a function in-place, so that
> existing
>> references to that function are modified.  That indeed is hard, or even
>> impossible in Python.
> 
> I explicitly said IT IS POSSIBLE in Python. :)
> 
<example snipped>

There is at least one very well know module that use this property :
'timeoutsocket' by Timothy O'Malley. It enhances the standard 'socket'
module.

Fortunately, there is also some limit to what can be done : you can't
overload methods on built in.

Unfortunately I don't think that C extensions will support such a 
mechanism.

Regards,
-- 

Pedro



More information about the Python-list mailing list