Passing new fields to an object

Paulo da Silva p_s_d_a_s_i_l_v_a_ns at netcabo.pt
Fri Jun 12 11:53:08 EDT 2015


I would like to do something like this:

class C:
	def __init__(self,**parms):
	...

c=C(f1=1,f2=None)

I want to have, for the object
	self.f1=1
	self.f2=None

for an arbitrary number of parameters.

What is the best way to achieve this?

Thanks




More information about the Python-list mailing list