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

M.-A. Lemburg mal@lemburg.com
Fri, 13 Jun 2003 00:22:08 +0200


Guido van Rossum wrote:

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

Why on earth would you be trying to instantiate something without having any idea what parameters are required? It could be the other way though: something could have a protocol where you can pass in a factory function that's called without arguments, and maybe you'd like to be able to pass it a built-in type. Something very close to this happened to me when testing Zope 3 filesystem synchronization.

Very close is still not good enough :-)

I can't really believe that you're designing protocols that have to call unknown factory functions to see whether they do something particular or not.

If you really happen to have a need for this, why can't you introduce factory functions which take care of your particular use case ? I don't think it's common enough to risk accidental progamming errors in other user's code.

-- Marc-Andre Lemburg eGenix.com

Professional Python Software directly from the Source (#1, Jun 13 2003)

Python/Zope Products & Consulting ... http://www.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/


EuroPython 2003, Charleroi, Belgium: 11 days left