Backward chaining for __init__?

Nick Mathewson nickm at mit.edu
Wed May 3 01:14:52 EDT 2000


On Wed, 03 May 2000 03:48:45 GMT, Courageous <jkraska1 at san.rr.com> wrote:
 [...]
>I'm curious, however, as to the philosophical justification
>for leaving backward-chaining ctors out of Python? While
>it's just synactic sugar, some kinds of sugar really taste
>good.

The best reason I can think of is that there's no behavior that's
sensible in every case.  
  1) If the base class's constructor takes arguments, how will you
     know which arguments to provide?
  2) If we're using multiple inheritance, which ctor do we call first?
  3) What if we want to initialize some of the object's state before we 
     call the ctor? (This is unusual, but not IMO completely pathological.)
   
Personally, I like Python's approach because it makes the chaining
explicit.  The fewer 'implicit' operations in a language, the less
often I need to run to a manual to find out what's really going on
under the hood.

Pointedly-eying-his-C++-reference'ly yours,

-- 
Nick Mathewson     <nickm at mit.edu>     http://www.mit.edu/~nickm/



More information about the Python-list mailing list