Set static attributes...maybe.
Beppe
giuseppecostanzi at gmail.com
Mon Aug 18 13:00:36 EDT 2014
hi to everybody,
in the following scrip I try to call the function read_parameters () but returns me that wants two arguments!?!?!
My intent is to have in the class, Engine (), some static attributes that can be used by other instances without to redefine this every time.
These matters could be for example a path or a connection to a database.
suggestions?
regards
beppe
class Master(object):
def __init__(self,):
pass
class Engine(Master):
dict_parameters = {}
def __init__(self,):
super(Engine, self).__init__()
@staticmethod
def read_parameters(self,path):
self.dict_parameters = {1:"a",2:"b"}
def check_parameters(self):
self.read_parameters("hello_world")
foo=Engine()
foo.check_parameters()
p.s.
I'm on Debian 6
More information about the Python-list
mailing list