no return values for __init__ ??

Helge Hess helge.hess at mdlink.de
Thu Jan 6 12:24:53 EST 2000


Hi there,

recently I was heavily wondering why __init__ does not allow return
values ! Is there any special reason not to do this ?

For example consider this
  
  C_singleton = None
  
  class C:
    def __init__(self):
      if C_singleton is None:
        c_singleton = self
      return C_singleton

  c1 = C()
  c2 = C()
  'if c1 is c2' will be true

It took me 5 minutes to change the Python interpreter to allow return
values, I'm just wondering why this wasn't implemented in the first
place ?!!

Hm,
  Helge
-- 
SKYRIX-OS  Web Application Environment - http://www.skyrix.com
SKYRIX-IAS Groupware Application Suite - http://www.skyrix.com



More information about the Python-list mailing list