[Python-ideas] parameter omit

Aaron Brady castironpi at comcast.net
Fri May 11 10:20:27 CEST 2007


> -----Original Message-----
> From: Josiah Carlson [mailto:jcarlson at uci.edu]
> 
> "Aaron Brady" <castironpi at comcast.net> wrote:
> > [snip]
> >
> 
> Should I send you my 486 laptop so that you can have access to a Python
> interpreter?  Because I really can't see how you being ignorant of the
> arguments to a standard library function in any way supports your case.
> 
> Further, if you always use 'None' as the default for functions being
> called, then you can get things like this...
> 
> class WebRetrieveElement:
>     hook = None
>     filename = None
> 
>     def netretrieveNew( self ):
>         filename= self.filename or ParamDefault
>         hook= hasattr( self,'hook' ) and self.hook or ParamDefault
>         urlretrieve( self.url, filename, hook )
> 
>     def netretrieveBest(self):
>         urlretrieve(self.url, self.filename, self.hook)
> 
> And look at that.  I define two class level variables and all of a
> sudden the implementation of netretrieveBest gets a trivial
> implementation (though it breaks netretrieveNew, which uses a generally
> frowned upon mechanism that fails when filename and hook are None).
> 
> But no, lets add a completely useless instance of object so that people
> can pass silly default arguments like ParamDefault that is a bazillion
> times more confusing than what Python users have been using for 15
> years; None.
> 
>  - Josiah

No thank you.  Your example is sufficient.  Well-crafted at that.  Good
example.

Imagine with me if you will.

Say I -am- "ignorant of the arguments to a standard library function".  But
say they aren't published in help().  Then that breaks yours and we have two
broken examples.  Great lot of good that did you.

Say the default is not None; but a class callback.  Say it is a default
string for a join delimiter somewhere.

Fine examples are imaginary numbers, the function string.split,
file([bufsize]), int([radix]), list.sort([cmp]), etc.  Pretty much anywhere
you see the [] brackets in the documentation.  These default values are
obvious, and further, None is always a good guess.  Answer this one
carefully: Have you asserted that defaults are -always- available and
published, in the standard library as well as elsewhere?  Could one extra
value in __builtins__ already be worth all our third-parties' time who could
relax and get along?  It'll bring world peace.

But sure.  Send your laptop on over.  I'll pay on delivery.

Sincerely,
That Newsgroup Jerk




More information about the Python-ideas mailing list