Giter Site home page Giter Site logo

Comments (1)

mdboom avatar mdboom commented on June 1, 2024

This is somewhat historical (when you create an AsdfFile, it may not have an underlying file object and therefore there is nothing to close). It should probably just be cleaned up in the docs/tests and elsewhere.

Actually, this use case is definitely valid, and in some cases the best way to "spell" things. First, when you make a raw AsdfFile, it has no on-disk file associated with it. Secondly, if you want to write the same AsdfFile to multiple files, you'll want a context manager around each call to write_to. Third, we can't just have write_to close the file because the user may want to keep the file open for updating (or accessing mem-mapped content).

An alternative could be to have other methods or keyword arguments that indicate "keep open for later updating"...

I guess the source of the confusion here is that AsdfFile objects aren't necessarily always associated with a file on disk? There's good reasons to want to do that -- validation without using the disk or a StringIO, for example.

#116 is a possible solution to this, but I'd also consider code changes that still keep updating possible...

from asdf.

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.