[Python-ideas] parameter omit

Aaron Brady castironpi at comcast.net
Sat May 12 02:56:03 CEST 2007


> -----Original Message-----
> From: python-ideas-bounces at python.org [mailto:python-ideas-
> bounces at python.org] On Behalf Of Aaron Brady
> > -----Original Message-----
> > From: Josiah Carlson [mailto:jcarlson at uci.edu]
> > Sent: Friday, May 11, 2007 3:00 AM
> > [snip]
> 
> class WebRetrieveElement:
> 	url= None
> 	filename= None
> 	hook= None
> 
> 	def netretrieveOld( self ):
> 			urlretrieve( self.url, self.filename, self.hook )
> 
> 	def netretrieveNew( self ):
> 			urlretrieve( self.url, self.filename, self.hook )

And while I'm at it and thinking clearly, with cool weather and open doors,
the basic problem here, underlying and distilled, is that None is serving
double-duty.  I've had a feeling so since month two.

It's used to signal an absence of a value.  But there are two distinct
situations in which it's needed.  One for values, two for function calls.

You could always require all parameter defaults to equal `None'.  But since
they're not, take this.

DefaultArg = object()




More information about the Python-ideas mailing list