Hi
How can I initialize a class like this from a file:
class Some:
def __init__(self,data,axis,**kwargs):
pass'data' and 'axis' should be lists of floats. Meta data can be passed to kwargs like 'name="name",date="2/3/05",...'.
Right now the return value of my function reading the file looks like this:
dummy = fromFile(path)
print dummy
[[[datalist],[axislist],'name="name"','date="2/3/05"',...],...]
And, of course, initializing Some with dummy[0] like: Some(dummy[0]) will throw an exception; a TypeError, since the argument list is not of the right length and of the wrong type.
Well, I've tried a few things to solve this problem, but didn't succeed: How do I have to alter FromFile() so, that I can use dummy to initialize Some? Oh, and I should mention that **kwargs can be of arbitrary length: __init__ has default values for every keyword not given.
And for the record: I'm still stuck with version 2.3 until I'll upgrade to Tiger (on OSX).
I'm totally lost. It would be great if you could help me out here.
Thanks a lot in advance, Christian
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
