Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """ Simulating atexit using weak references """
- # Don't use this code - it is just for illustration.
- # Generally speaking it is better not to rely on order of
- # gc to implement a feature.
- import weakref
- class C: pass
- def goodbye(param):
- print 'Bye.',param
- x=weakref.ref(C, goodbye)
- if __name__ == '__main__':
- print 3+4
- print 8+9
- print globals()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement