[Patches] Making modules callable when they have the attribute "__call__"
Mark Hammond
mhammond@skippinet.com.au
Sat, 15 Apr 2000 11:49:16 +1000
> Mark Hammond <mhammond@skippinet.com.au> writes:
>
> >> Attached you find patches that make modules
> >> callable when they have
> >> an attribute "__call__". I think that this makes
> >> Python mode
> >> orthogonal. YMMV.
>
> >Wouldnt a better patch be to fill out the tp_call slot
> for the module?
>
> Nope. Unless you want to make a module without
> __call__ attribute
> also callable.
I would have thought so, yes. Sort-of.
You mention your motiviation as making Python more orthogonal - then
IMO, calling a module with no __call__ attribute should raise an
attribute error, just like attempting to call an instance with no
__call__ attribute.
Mark.