Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76489
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2014-08-18 10:00 -0700 |
| Message-ID | <5cb1f29f-b502-4509-be42-1d053f89fbbd@googlegroups.com> (permalink) |
| Subject | Set static attributes...maybe. |
| From | Beppe <giuseppecostanzi@gmail.com> |
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
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Set static attributes...maybe. Beppe <giuseppecostanzi@gmail.com> - 2014-08-18 10:00 -0700
Re: Set static attributes...maybe. Chris Kaynor <ckaynor@zindagigames.com> - 2014-08-18 10:13 -0700
Re: Set static attributes...maybe. Beppe <giuseppecostanzi@gmail.com> - 2014-08-18 10:33 -0700
csiph-web