Giter VIP home page Giter VIP logo

Comments (3)

paulsbond avatar paulsbond commented on June 18, 2024

I just found some information from another project that had the same error from a pybind11 object:
google-deepmind/open_spiel#88

They point to the following in the pybind11 docs:
https://pybind11.readthedocs.io/en/stable/advanced/classes.html#pickling-support

I guess this could be quite an undertaking for a complex class though. Hopefully there'll be something simpler I'm missing. In the meantime I might just write the structure to disk and read it again.

from gemmi.

wojdyr avatar wojdyr commented on June 18, 2024

To have deepcopy working it would be probably sufficient to implement __deepcopy__ method. I was thinking about it, but in the end I added methods clone() to Structure, Model, Chain, Residue and Atom. It's a one-line function. I'm on the fence what's better: copy.deepcopy(st) or st.clone().

from gemmi.

paulsbond avatar paulsbond commented on June 18, 2024

Awesome, thanks. I think either approach is fine, unless you also wanted to implement a shallow copy but I can't think of a use case for that.

from gemmi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.