Callable modules?

Alex Martelli aleax at aleax.it
Wed Jul 24 12:11:13 EDT 2002


Jonathan Hogg wrote:
        ...
> For example, there is no way of redefining the 'repr' of a function, or
> the attribute interface. Without __call__ the closest I could come would
> be to define a metaclass that creates class objects with a __new__ method
> implementing the call interface - a truly monstrous idea.

You have a point.  Such a need is so rare and weird that I would not be
highly troubled by having to use weird ways to meet it.  However, taking
"callability" as outside the range of polymorphically emulable behaviors
would indeed reduce regularity, so it might be a bad idea even though the
serious use cases for it ARE weird:-).


Alex




More information about the Python-list mailing list