Code Monkey home page Code Monkey logo

Comments (3)

saschahofmann avatar saschahofmann commented on September 25, 2024 2

Ah perfect, than my observation is what is expected.

To your question: yes I think I would find a return value documentation helpful.
As a minimum I would add a line similar to what you can find on the docs for load

Unlike compute, the original dataset is modified and returned.

or compute

Unlike load, the original dataset is left unaltered.

I would just copy the latter from compute and add it to persist?

I can also add the return value but technically load also returns the updated Dataset. I could just not add it in the documentation though?

from xarray.

keewis avatar keewis commented on September 25, 2024

in general, there are only very few in-place methods (.load and .update are the only examples I can think of). As far as the code goes: it creates a (shallow) copy, then replaces the arrays in that copy with the persisted ones. So yes, persist does not modify the original object.

A PR would be welcome, but I wonder how to best point this out: since it's the general rule, I feel functions that don't follow it should stress that more... maybe adding return value description would help already?

from xarray.

keewis avatar keewis commented on September 25, 2024

see also #6837 for a discussion about the difference between compute and load.

from xarray.

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.