copy construtor question
xiaosong xia
xiaosongxia at yahoo.com
Fri Aug 28 14:38:30 EDT 2009
Hi all,
I am trying to define a class with copy constructor as following:
class test:
def __init__(self, s=None):
self=s
x=[1,2]
y=test(x)
print y.__dict__
it gives
{}
The above code doesn't work.
Questions are:
1. Can 'self ' be a class attribute?
2. How to make a copy constructor?
Thanks for any help.
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090828/872eb8b3/attachment.html>
More information about the Python-list
mailing list