Is it allowed to use function results as default arguments ?

Stef Mientki stef.mientki at gmail.com
Tue Jul 29 03:43:26 EDT 2008


Terry Reedy wrote:
> To answer the subject line:
> param=<any expression that can be evaluated when the function is defined>
> will assign the result of the expression as the default argument 
> object for the parameter.
>
thanks Terry and others,

brings me to one other question:
  I guess this function is only evaluated once, is that correct ?

about os.curdir,
I checked it, it's already a constant ;-)
and because I use afterwards:
   os.path.abspath('.'')
which is identical to
  os.path.getcwd()

about '.' being the current directory,
well I think windows was thrown at the market about 25 years ago,
and since then we don't use '.' anymore ;-)

cheers,
Stef
> tjr
>
> -- 
> http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list