[Python-Dev] Default constructor values (Re: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.134,1.135)

M.-A. Lemburg mal@lemburg.com
Wed, 11 Jun 2003 11:00:27 +0200


Raymond Hettinger wrote:
>>>* Indicate that arguments are optional for most builtin type constructors.
>>
>> > ...
>>
>>>! \begin{funcdesc}{bool}{\optional{x}}
>>
>>This sounds weird:
>>
>>* Why should object constructors have an optional argument without
>>   a default value ? Why aren't these default values documented ?
>>
>>* This "feature" sounds like it will hide programming errors.
>>
>>* What is the purpose of the "feature" ?
> 
> I'm not following whether you don't like the implementation or 
> documentation.  My patch just documents the existing implementation.

Your patch just made me aware of this fact (whether or not it's
a good feature, having accurate documentation is always good :-).

> The implementation has been in for a while (GvR checked in Alex's 
> patch for www.python.org/sf/724135 ).  The news item reads:
> 
> - bool() called without arguments now returns False rather than
>   raising an exception.  This is consistent with calling the
>   constructors for the other builtin types -- called without argument
>   they all return the false value of that type.  (SF patch #724135)

I seriously question the usefulness of such an approach. It
doesn't seem to buy us anything and is likely to hide typos
or progamming errors.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Software directly from the Source  (#1, Jun 11 2003)
 >>> Python/Zope Products & Consulting ...         http://www.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
EuroPython 2003, Charleroi, Belgium:                        13 days left