public
Created

Python does have open classes

  • Download Gist
open_classes.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14
class A(object):
def p(__self__):
print("1")
 
a = A()
 
a.p()
 
def p2(__self__):
print("2")
 
A.p = p2
 
a.p()

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.