Diez B. Roggisch wrote:
Ilias Lazaridis schrieb:
remark: not sure if the term dictionary is correct here.
I have the following situation:
within a setup.cfg, settings are passed this way:
settings=project_page=theProjectPage.com
myVar=myValue
those are accessible later like
Ben Wilson wrote:
Perhaps:
def dictionary_make_attributes(self, settings):
for k,v in settings:
setattr(self, k, v)
this one resulted in an error:
ValueError: too many values to unpack
it works with this correction:
for k,v in settings.items()
Alex Martelli wrote:
Ben Wilson [EMAIL PROTECTED] wrote:
Perhaps:
def dictionary_make_attributes(self, settings):
for k,v in settings:
setattr(self, k, v)
for k,v in settings.items()
This is a very general solution and will work for all kinds of objects
with settable
remark: not sure if the term dictionary is correct here.
I have the following situation:
within a setup.cfg, settings are passed this way:
settings=project_page=theProjectPage.com
myVar=myValue
those are accessible later like this:
settings['project_page'] / settings['myValue']
-
Ilias Lazaridis schrieb:
remark: not sure if the term dictionary is correct here.
I have the following situation:
within a setup.cfg, settings are passed this way:
settings=project_page=theProjectPage.com
myVar=myValue
those are accessible later like this:
Perhaps:
def dictionary_make_attributes(self, settings):
for k,v in settings:
setattr(self, k, v)
http://ftp.python.org/doc/lib/built-in-funcs.html#l2h-64
--
http://mail.python.org/mailman/listinfo/python-list
Ben Wilson [EMAIL PROTECTED] wrote:
Perhaps:
def dictionary_make_attributes(self, settings):
for k,v in settings:
setattr(self, k, v)
This is a very general solution and will work for all kinds of objects
with settable attributes, even if some of the attributes are