I Spy Code - Python

Method Arguments

Here is a python example that shows how to pass arguments to methods:

Source: (example.py)

class Foo:
  def addnums(self,num1,num2):
    return num1 + num2
 
f = Foo()
total = f.addnums(10,15)
print(total)
 

Output:

$ python example.py
25


Related Examples

Call Methods Dynamically
Docstring
Initializing Object Variables
Method Arguments
Subclass Inherits Method
Test For Null Object
hqdwppls.php

7