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

Guido van Rossum guido@python.org
Wed, 11 Jun 2003 09:05:08 -0400


> > - 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.

Types with constructors that insist on an argument are problematic to
generic code that tries to instantiate a type by simply calling it.

I don't think that there's much chance that e.g. str() or int() will
be used by accident and not discovered right away.

--Guido van Rossum (home page: http://www.python.org/~guido/)