Just change the line
in Shambler's second bit of code to
That's it. Think of functions as a property of the type itself, rather than specific objects of the type.
Do you understand the use of Globals in types? It's a very similar idea.
a.do_function(a)
in Shambler's second bit of code to
mytype.do_function(a)
That's it. Think of functions as a property of the type itself, rather than specific objects of the type.
Do you understand the use of Globals in types? It's a very similar idea.