Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> class Test(object):
- def __new__(cls):
- print ("new")
- return super(Test, cls).__new__(cls)
- def __init__(self):
- print ("init")
- >>> Test()
- new
- init
- >>> class Test2(object):
- def __str__(self):
- return "I am test 2"
- >>> class Test1(object):
- def __new__(cls):
- return Test2()
- >>> print(Test1())
- I am test 2
Add Comment
Please, Sign In to add comment