Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > share info between methods in a Class

Thread Tools

share info between methods in a Class

Garcia, Paul D
Posts: n/a
What is the best way to access/change list or dictionary information between methods in the same class?

Note : I would normally have the input_list originally populate by reading in a file.

Currently I have:

class Action:

def __init__(self):

self.input_List = list()
self.output_List = list()

self.ID_Name_Dict = dict()
self.ID_Serial_Dict = dict()

def get_Info(self, bldg=None):

self.input_List = '1111111 Tom xyz-001 Enabled', '2222222 Dick xyz-002 Disabled', '3333333 Harry xyz-003 Enabled', \
'4444444 Jane abc-999 Disabled', '5555555 Holly xyz-999 Enabled', '6666666 Mary xyz-004 Enabled'

for line in self.input_List:
if line.find('Disabled') <= 0:

item = line.split()
ID = item[0]
Name = item[1]
Serial = item[2]

self.ID_Name_Dict[ID] = Name
self.ID_Serial_Dict[ID] = Serial

def parse_Info(self, bldg=None):

for each in self.ID_Name_Dict:
if each.find('xyz') >= 0 and each.find('-999') <= 0:


If this is not correct, can anyone provide some guidance?



Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Share-Point-2010 ,Share-Point -2010 Training , Share-point-2010Hyderabad , Share-point-2010 Institute Saraswati lakki ASP .Net 0 01-06-2012 06:39 AM
calling class methods from class methods, help? Oltmans Python 6 03-11-2009 07:59 PM
Is there a way to find the class methods of a class, just like'methods' finds the instance methods? Kenneth McDonald Ruby 5 09-26-2008 03:09 PM
share function argument between subsequent calls but not between class instances! K. Jansma Python 7 02-21-2006 01:31 PM
difference between class methods and instance methods John M. Gabriele Python 18 02-18-2005 05:17 PM