Comments (4)
I had been looking at this as part of #59 already as I needed to initalise Passes from an already constructed Target object there.
But I agree that it makes sense in general, and possibly should even be the default, as my thought process when working the REPL usually goes something like:
# make a target
>>> t = Target("10_zone", (122, "cm"), (70.0, "m"))
# try and make a pass with it
>>> p = Pass(36, t)
ValueError(...)
# swear, remember I have to recreate the Pass with the same parameters
>>> p = Pass(36, "10_zone", (122, "cm"), (70.0, "m"))
from archeryutils.
OK, My gut suggests doing it as a separate PR, but happy for it to come from #59 given you have already started.
I think having target as default, and then having a pass_from_base_target_data
classmethod (not called that, but I can't come up with a more concise but clear name right now) is probably best, as you suggest.
Other option would be overloading, but I think that could get messy given they are mutually exclusive argument options rather than one being a subset.
from archeryutils.
I agree on a classmethod to replicate the current way of initalising passes makes sense, and consistent with the approaches to initialising Targets in that PR as well (seperate constructors rather than overloading). But not averse to factoring that bit out from there and doing it first to keep the changes more focused, especially given this is another breaking API change for all the tests.
. Naming it is tricky, I'd thought of: Pass.from_scratch
, Pass.from_parameters
, Pass.without_target
. But I don't love any of them. And Pass.from_target_data
is potentially confusing with the custom target concepts. How about Pass.and_target
or Pass.with_target
?
Maybe inspiration will come.
from archeryutils.
Got an implementation using at_target
for the classmethod name, obviously that one open to change but it seems not too bad. Snuck in some useful reprs because trying to check these in the repl without them was deeply unpleasant.
Mini PR incoming.
from archeryutils.
Related Issues (20)
- Add binder instance for examples notebook
- Upload to pypi HOT 8
- Documentation HOT 2
- Simplify passing of magnitude and units in the code.
- Allow handicap calculation for generic scoring systems HOT 3
- Bug: Possibility to define a round with no passes
- Make some handicap_functions methods private HOT 2
- Type hinting improvements
- Update README with new docs info
- Data from read_json functions could be stored as constants
- Feature Request: Add 11-zone (Lancaster) Target to scoring systems HOT 2
- Bump to Python 3.10
- Documentation: Describe supported scoring systems (with visual examples?) HOT 1
- UserWarning spam on module import
- get_max_score_handicap is slowing down test suite HOT 4
- Feature Request: Move to ruff for linting
- Tidy methods lists in tests
- Bug in definition of WA Field target
- Tidy Misc Rounds
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from archeryutils.