28-08-2009 o 20:38:30 xiaosong xia wrote:
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.
And cannot, as Chris has already wr
En Fri, 28 Aug 2009 21:47:51 -0300, Chris Rebert
escribió:
On Fri, Aug 28, 2009 at 11:38 AM, xiaosong xia
wrote:
2. How to make a copy constructor?
Since Python lacks overloading based on parameter types, generally one
does it the other way around and instead provides a method that
produce
On Fri, Aug 28, 2009 at 11:38 AM, xiaosong xia wrote:
> Hi all,
>
> I am trying to define a class with copy constructor as following:
>
> class test:
>
> def __init__(self, s=None):
>
> self=s
Python uses call-by-object
(http://effbot.org/zone/call-by-object.htm), so reassigning `se