Tuesday, February 8, 2011

jython copy versus clone

We're a Java shop at work. We do a lot of passing of Java objects back and forth through the jython API to our application.

The other day I had the need to copy a Java object. It was a flat structure and my instinct was to use the object's clone method, which I did. This got me thinking about the use of clone versus the copy module in jython and I gave it a look: