Is it allowed to use function results as default arguments ?

Guilherme Polo ggpolo at gmail.com
Tue Jul 29 00:38:24 CEST 2008


On Mon, Jul 28, 2008 at 5:28 PM, Stef Mientki <stef.mientki at gmail.com> wrote:
> hello,
>
> I've a perfect working procedure,
> at least as far I've tested it it works perfect.
>
> But I was just experimenting with inspect,
> and saw that the default argument was not parsed correctly.
>
> So I wonder if this is allowed:
>
> def Get_Relative_Path ( target, base=os.curdir ) :
>  ...
>
> As inspect returns the following:
>
> (['target', 'base'], None, None, ('.',))

Are you referring to the last item in the tuple above ? It is merely
listing the default values, it is not associating target to '.'. What
else would the tuple be if there is just base with a default value ?

>
> thanks,
> Stef Mientki
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
-- Guilherme H. Polo Goncalves



More information about the Python-list mailing list