> Now, how do I create an instance of MyClass when calling:
x = MyClass.fromfile(path) ?
Why not use an instance method and just do:
x = MyClass().fromFile(path)
provided fromPath() returns self there should be no problem.
That is, MyClass looks like:
class MyClass:
def __init__(self): pass
def fromFile(self, fname):
f = open(fname,'r')
self.attribute = f.readline().strip()
self.attribute1 = f.readline().strip()
self.attribute2 = f.readline().strip()
f.close()
return self
> return parameter1,parameter2,...,d
Instead of returning them you store them in the object.
Or am I missing something?
It is possible to write true class methods but I'm not sure
this is the best place to use them.
Alan G.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor