Code Monkey home page Code Monkey logo

Comments (8)

rhempel avatar rhempel commented on September 28, 2024

This is a file handle cache - the purpose of the extra bits in the device version is that it allows you to open a file with only the mode you ask for - maybe we can modify things so that if an attribute is r/w you get the right mode the first time :-) The reopen is only needed if you write to an attribute, and then read it later.

from ev3dev-lang-python.

ddemidov avatar ddemidov commented on September 28, 2024

We can also make the cache key to be file_name/mode. This will have two versions of the same file in cache, but would not require reopen.

from ev3dev-lang-python.

rhempel avatar rhempel commented on September 28, 2024

I'm not sure having one descriptor open for read and another for write is a good thing - I guess as long as the seek points are truly independent it will work - not sure though.

from ev3dev-lang-python.

ddemidov avatar ddemidov commented on September 28, 2024

It certainly works in C++ bindings. I agree it sounds a bit wasteful. And the trick with reopening on exception should work for all cases.

from ev3dev-lang-python.

ddemidov avatar ddemidov commented on September 28, 2024

Although it's not clear how to incorporate the trick into cache, since the try block should be around both cache access and file operation. May be we should think not about file handle cache, but file reader /writer?

from ev3dev-lang-python.

rhempel avatar rhempel commented on September 28, 2024

+1 File reader/writer (that takes advantage of a cache for file handles) :-)

from ev3dev-lang-python.

ddemidov avatar ddemidov commented on September 28, 2024

Something like this: https://github.com/ddemidov/ev3dev-lang-python-1/commit/00ed2429497828589da087ce0ba3cea2b6357348?

from ev3dev-lang-python.

ddemidov avatar ddemidov commented on September 28, 2024

Resolved by #31

from ev3dev-lang-python.

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.