init_return.py

download

class LegalConstructor1(object):

def __init__(self):
return

class LegalConstructor2(object):

def __init__(self):
return None

class IlegalConstructor(object):

def __init__(self):
return "x"

class LegalConstructorOld1:

def __init__(self):
return

class LegalConstructorOld2:

def __init__(self):
return None

class IlegalConstructorOld:

def __init__(self):
return "x"

a = LegalConstructor1()
print a

b = LegalConstructor2()
print b

x = LegalConstructorOld1()
print a

y = LegalConstructorOld2()
print b

# !!! This should raise TypeError
c = IlegalConstructor()
print c

z = IlegalConstructorOld()
print z