[Python-Dev] PEP 303: Extend divmod() for Multiple Divisors

Alex Martelli aleaxit@yahoo.com
Thu, 2 Jan 2003 15:06:23 +0100


On Thursday 02 January 2003 03:03 pm, Paul Hughett wrote:
> Guido wrote:
> > > Hey, if we'll killing off builtins, I vote for apply().
> >
> > Agreed, it's redundant.  You can help by checking in documentation
> > that marks it as deprecated and code that adds a
> > PendingDeprecationWarning to it (unfortunately it's so common that I
> > wouldn't want to risk a plain DeprecationWarning).
>
> You've lost me here.  I've recently written a piece of code that uses
> a lookup table on the name of a file to find the right function to
> apply to it; if I don't use apply for this, what should I use?  An

    thetable[thefilename](thefilename)

should do just as well as

    apply(thetable[thefilename], (thefilename,))

and more compactly and readably, too.


Alex