Coder Social home page Coder Social logo

Comments (3)

jbednar avatar jbednar commented on June 11, 2024

When instantiate=True leads to copying the Parameter object, can we make it do a copy (not a deepcopy) of any mutable slot values (or all slot values, which should have the same result)? That seems cheap enough and preserves object identity for the items in the Selector while avoiding this problem.

The only mutable types I can see in slot values are all containers (_objects and names here, plus attribs for Composite, columns potentially on DataFrame, and search_paths on Path), so maybe we could shallow copy only containers, since arbitrary class instances aren't necessarily safe to copy if some Parameter did have a slot with such an item. For current Parameter types I think shallow copying everything, all mutable values, and containers would have the same result, so it may not matter much.

I'm pretty sure that for all those cases, sharing the contents of the container across instantiated Parameter objects would be seen as a bug and not expected behavior. I.e., if the user wanted that Parameter instantiated, they will want independent containers, because if they wanted them all to share the same values they wouldn't have instantiated the parameters.

from param.

maximlt avatar maximlt commented on June 11, 2024

When instantiate=True leads to copying the Parameter object, can we make it do a copy (not a deepcopy) of any mutable slot values (or all slot values, which should have the same result)?

Yes there's nothing that prevents us from doing that when instantiate=True. However that doesn't resolve neither this issue nor #746 as they deal with the Selector Parameter which is set by default with instantiate=False, right?

from param.

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.