Re: Is it allowed to use function results as default arguments ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stef Mientki

    #1

    Re: Is it allowed to use function results as default arguments ?

    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
  • Steven D'Aprano

    #2
    Re: Is it allowed to use function results as default arguments ?

    On Tue, 29 Jul 2008 09:43:26 +0200, Stef Mientki wrote:
    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 ;-)
    No, even Windows uses '.' as the current directory -- at least XP does, I
    haven't tried Vista.

    However, old Classic Mac OS (pre OS-X) used ':' for the current
    directory, so dot isn't universal.


    --
    Steven

    Comment

    • Grant Edwards

      #3
      Re: Is it allowed to use function results as default arguments ?

      On 2008-07-29, Stef Mientki <stef.mientki@g mail.comwrote:
      brings me to one other question:
      I guess this function is only evaluated once, is that correct ?
      Yes.
      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 ;-)
      Who's "we"? I stull use "." as the current directory.

      --
      Grant Edwards grante Yow! Mary Tyler Moore's
      at SEVENTH HUSBAND is wearing
      visi.com my DACRON TANK TOP in a
      cheap hotel in HONOLULU!

      Comment

      Working...