Git Product home page Git Product logo

Comments (7)

tomasbedrich avatar tomasbedrich commented on July 30, 2024

Okay, this looks like a good idea.

I just have to think, where to put the parsing code? Do you think, it would be more meaningful to put it in a complex loop to Cache class? Or something like from_html method in a new Waypoint class + a simpler loop during the cache loading? It is kind of philosophical question...

from pycaching.

forslund avatar forslund commented on July 30, 2024

Had some trouble rebasing the my branch. My initial thought was that yet another class would be a bit of an overkill but after trying to implement this it might be better to have a class instead of a namedtuple. The parsing loop is a bit tricky since two lines need to be parsed for each entry, I would definitely split the parsing from the main load() method since it is complex enough as it is.

This first suggestion is how I personally would do it, a function returning a dict is ok since it doesn't need any persistent state stored in Cache object but it breaks the coding style a bit.

A separate class might be the best solution?

from pycaching.

tomasbedrich avatar tomasbedrich commented on July 30, 2024

First of all, please unify the naming. I think Waypoint is better than AdditionalLocation, because it is brief and straightforward. Regarding the naming – there are also some misuses of "waypoint" word in the docstrings, it would be great to update them to something like "GC codes", "waypoint codes" or something similar.

Yes, the function returning a dict is a good solution, but current code location is really unfortunate. I would prefer creating a new class (Waypoint) with a class method parsing the waypoints into dict (exactly like you did). Something in style of cache.Size.from_string, but returning a dict of instances. In the final, the Waypoint class would be just smarter namedtuple with one class method.

from pycaching.

forslund avatar forslund commented on July 30, 2024

Ok, I'll look into it during the weekend.

from pycaching.

forslund avatar forslund commented on July 30, 2024

I've done the changes you suggested and changed waypoint -> GC code in cache.py. Is this what you intended or did I misunderstand something?

Should I add a str and repr to the class or is it ok to have a "bare bones" class?

Test aren't included yet.

from pycaching.

tomasbedrich avatar tomasbedrich commented on July 30, 2024

It looks good. Just a few more things:

  • Documentation for Cache.waypoints property – please add a :type.
  • Documentation for Waypoint class properties – it would be better to have it in the style of Cache class, because of nicer documentation rendering.
  • The tests, as you said.
  • Optionaly str or repr methods – I will leave it completly up to you, what do you think it will be more useful.

from pycaching.

tomasbedrich avatar tomasbedrich commented on July 30, 2024

I have just merged #59 and will release the features in version 3.5. Thank you Åke and happy easter to you too!

from pycaching.

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.