Default parameters

Carl Banks imbosol at aerojockey.invalid
Sat Dec 20 19:00:37 EST 2003


Rainer Deyke wrote:
> 
> 
> Carl Banks wrote:
>> You ideas about what a function's purpose is are just not relevant to
>> whether the time of evaluation is consistent.
> 
> I'm not talking about whether or not time of evaluation is consistent -
> clearly either way is consistent so long as it is consistently used.  I'm
> saying that getting a fresh copy of default args is useless and dangerous
> because it only helps with functions which shouldn't be written in the first
> place.


Well, ok.  I don't agree that it's dangerous, and there are certainly
useful functions that modify their arguments that could benefit from a
fresh copy.

    def top_secret_code(a,b,c,stub=[]):
        stub.extend([f(a,b),g(b,c),g(c,a)])
        return stub


-- 
CARL BANKS                      http://www.aerojockey.com/software
"If you believe in yourself, drink your school, stay on drugs, and
don't do milk, you can get work." 
          -- Parody of Mr. T from a Robert Smigel Cartoon




More information about the Python-list mailing list