[Python-ideas] Default arguments in Python - the return - running out of ideas but...

CTO debatem1 at gmail.com
Fri May 15 04:41:19 CEST 2009


On May 14, 8:19 pm, Steven D'Aprano <st... at pearwood.info> wrote:
> On Fri, 15 May 2009 09:28:02 am CTO wrote:
>
>
>
> > On May 14, 6:27 pm, Steven D'Aprano <st... at pearwood.info> wrote:
> > > On Thu, 14 May 2009 09:03:34 am CTO wrote:
> > > > Thanks for the input, but I've already written the code to do
> > > > this. It
> > > > is available at
> > > > <URL:http://code.activestate.com/recipes/576751/>.
>
> > > [...]
>
> > > > The gode given is slow and ugly, but it does appear-
> > > > at least to me- to do what is being asked here.
>
> > > Your code seems to work only if the source to the function is
> > > available. That will mean it can't be used by people who want to
> > > distribute .pyc files only.
>
> > > --
> > > Steven D'Aprano
>
> > I think the list is eating my replies, but suffice to say that
> > there's a new version of the recipe at <URL:
> >http://code.activestate.com/recipes/576754/> that doesn't have that
> > limitation and looks pretty close to the syntax proposed above.
>
> And instead has another limitation, namely that it only works if you
> pass the non-default argument by keyword.
>
> f(123, y=456)  # works
> f(123, 456)  # fails if y has been given a default value.
>
> --
> Steven D'Aprano

Correct. However, I remain confident that someone with ever so
slightly
more skill than myself can correct that problem- since you already
seem to have taken a look at it, maybe that's something you could
do? Thanks in advance,

Geremy Condra



More information about the Python-ideas mailing list