• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /macosx-10.10/pyobjc-45/2.6/pyobjc/pyobjc-framework-Cocoa/Examples/Foundation/Scripts/
1#
2# Demonstrates that the super-class implementation of an overridden method
3# can be called in the same way as with normal objects.
4#
5from Foundation import *
6
7N = 1
8
9class MyObject (NSObject):
10    def init(self):
11        global N
12        if N == 1:
13            print "Calling super.init"
14            N = 0
15
16            # Call super-class implementation.
17            super(MyObject, self).init()
18
19        else:
20            print "Cyclic call detected"
21
22
23x = MyObject.alloc().init()
24