Python allows for defining functions and classes with methods. A class with methods is basically similar to a function block in ST, or classes in languages such as C++, Java, or C#. However, Python does not support interfaces.
For detailed information, see the Python documentation for defining ⮫ Functions and ⮫ Classes.
Examples: Functions, classes, and methods
#defining a function with name sum and two parameters a and b: def sum(a, b): return a + b # we return the sum of a and b. # we can now call the function defined above: print(sum(5,7)) # Now we define a class Foo: class Foo: # The class gets a method "bar". # Note: for methods, the first parameter is always "self" and # points to the current instance. This is similar to "this" in # ST and other languages. def bar(self, a, b): print("bar(%s,%s)" % (a,b)) # We create an instance of the class: f = Foo() # We call the method bar on the instance. f.bar("some", "params")