N
Nathan Harmston
Hi,
Sorry if the subject line of post is wrong, but I think that is what
this is called. I want to create objects with
class Coconuts(object):
def __init__(self, a, b, *args, **kwargs):
self.a = a
self.b = b
def spam( l )
return Coconuts( l.a, l.b, l.attributes )
l in a parse line of a file which is a tuple wrapped with
attrcol......with attributes a, b and attributes (which is a list of
strings in the format key=value ie...
[ "id=bar", "test=1234", "doh=qwerty" ] ).
I want to add attributes to Coconuts so that I can do
print c.id, c.test, c.doh
HOwever I m not sure how to do this:
how can i assign args, kwargs within the constructor of coconuts and
how can I deconstruct the list to form the correct syntax to be able
to be used for args, kwargs.
HOpe this makes sense,
Thanks in advance,
Nathan
Sorry if the subject line of post is wrong, but I think that is what
this is called. I want to create objects with
class Coconuts(object):
def __init__(self, a, b, *args, **kwargs):
self.a = a
self.b = b
def spam( l )
return Coconuts( l.a, l.b, l.attributes )
l in a parse line of a file which is a tuple wrapped with
attrcol......with attributes a, b and attributes (which is a list of
strings in the format key=value ie...
[ "id=bar", "test=1234", "doh=qwerty" ] ).
I want to add attributes to Coconuts so that I can do
print c.id, c.test, c.doh
HOwever I m not sure how to do this:
how can i assign args, kwargs within the constructor of coconuts and
how can I deconstruct the list to form the correct syntax to be able
to be used for args, kwargs.
HOpe this makes sense,
Thanks in advance,
Nathan