Python vs C for a mail server

Paul Boddie paul at boddie.org.uk
Sun Jan 29 19:10:59 EST 2006


Fredrik Lundh wrote:
> Paul Boddie wrote:
>

[Quoting Jay Parlar...]

> > > I don't think I've ever seen anyone advocating calling a function like
> > > getattr(obj "foo" + "bar")().
> >
> > >From Lib/compiler/visitor.py:
> >
> > meth = getattr(self.visitor, 'visit' + className, 0)
> >
> > Later on:
> >
> > meth(node, *args)

[...]

> if you read Jay's assertion in context, your "refutation" strikes me as
> somewhat silly.

The context was whether you can know before running the program whether
the function you're attempting to call exists, along with where it is
defined. Obviously, it's a struggle to think of cases where one would
do this for the sake of it (especially with hard-coded string
literals), but where one wants to take some value (eg. a class name)
and dispatch to some callable (eg. some visitor handler method) based
on that dynamic information, it's a useful technique. Whether
widespread usage of such a technique counts as advocacy is a matter I
don't find particularly interesting to discuss.

Or should I be looking for some other context here?

Paul




More information about the Python-list mailing list