|
From: Barbalute <Bar...@gm...> - 2010-03-08 19:49:37
|
As the name suggests, it seems that copy and deepcopy aren't copying the variables in my Java class. I currently have a Python class extending an existing Java abstract class. For various reasons, I've overwritten clone() in the Python class so that when the Java class calls it, it returns a deepcopy() of itself. This seems to properly copy the methods from the class, but the variables from the abstract Java class are lost in the copy, and I have no idea why. In the overwritten Python clone() method, I'm able to manually copy over the variables, doing for example: x = copy.deepcopy(self) x.name = self.name return x But this shouldn't be necessary and becomes increasingly unwieldy for classes with lots of variables. If I don't do it, though, name is not set in x and will return null in Java. Am I doing something wrong, or is something broken with copy() and deepcopy()? Thanks for your time. -- View this message in context: http://old.nabble.com/copy-and-deepcopy-not-copying-Java-class-variables--tp27826254p27826254.html Sent from the jython-users mailing list archive at Nabble.com. |