oop - What is adding methods to a class instead of "properly" subclassing called? -


take simple example in :

>>> class a(object): ...     pass ... >>> def f(self): ...     print "f called" ... >>> a.f = f >>> = a() >>> a.f() f called 

so in example, existing class a gets additional (instance) function f (though overriding existing ones works well). in real life of course happen e.g. in different modules. how procedure called?

not sure following you, if do, talking extension methods


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -