initializing a class
Janos Blazi
jblazi at netsurf.de
Thu Jun 15 05:45:38 EDT 2000
I need several constructors for a class. So would this pseudo code be in
order:
class x:
...
class y:
...
class z:
def __init__(self,a)
if isinstance(a,x):
z.t=x.t1+x.t2
elif isinstance(a,y):
return z(y.x)
else:
...
When the constructor for class z is called, its argument is checked. If the
argument is class x, then the instance is constructed directly. Otherwise,
when the argument is class y then the constructor is called again with a
class y argument.
J.B.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
More information about the Python-list
mailing list