[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
Thu, 12 Jun 2003 13:57:07 +0200


Greg Ewing wrote:
> Tim:
> 
>>[Greg Ewing]
>>
>>>Why on earth would you be trying to instantiate something
>>>without having any idea what parameters are required?
>>
>>For example, unpickling can need to do this when a type uses the
>>__getstate__ + __setstate__ pickle subsystem 
> 
> But that can't possibly work for immutable types.

Right and it's also not really needed since new style classes
provide __new__ and __init__ as two separate entry points.
pickle would have to call __new__ on these and then call
__setstate__ if the protocol is supported by the type.
(At least that's how understand it should work :-)

Given that approach, you don't need to call __init__
at all.

Still waiting for that use case... :-) Otherwise the whole idea
looks too much like a YAGNI if you ask me.

-- 
Marc-Andre Lemburg
eGenix.com

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