Showing posts with label class. Show all posts
Showing posts with label class. Show all posts

Monday, July 11, 2011

Accessing instance variable in Python

To access a Python instance variable outside the class:

class Sample:
def __init__(self, max):
self. max = max
....

sampleinstance = Sample(2)
max = sampleinstance.max