feat: add stats accessor as alternative to statistics#1448
Conversation
|
Not sure about this one, it is not hard to type But what i would really like is a statistics accessor that by default includes So, i'd be persuaded for creating: I still think, that probably is very hacky api design. |
|
thanks @coroa, I personally don't like writing out but I agree that this should probably go to false per default. |
I know that the setting works, but in library code i always feel very uncomfortable with using such global settings since you never know whose assumption you are breaking later on in the code. But if you agree it would be good by default as @lkstrp What do you think about this proposal? |
|
I am fine with @coroa So you mean I also agree that there are downsides to the global setting and that we should switch to 'nice_names=False' by default. But we can't do that right now. Rather than adding another accessor just for that purpose, I would fix it step by step:
pypsa.options.params.statistics.nice_names = (False, 'strict') # or similar
# and the following would raise an error then
pypsa.options.params.statistics.nice_names = TrueI am against breaking with 1.1 and simply changing the default. Not sure if the use case is already big enough to violate semver. And also quite against |
No, |
|
That makes more sense, but it doesn't change anything. We don't just want to change functionality for an alias. If there would be more stuff different, we could package it as the "new statistics accessor". But there is not. We should just properly deprecate and change the defaults if we wanna change them. Also we not even have |
Yes, please.
Hmm .., i don't understand that. Aren't settings always global? Why would you have a setting then? |
Yes, i'm always confused by that. ie. i always start of with n.expressions and then have to add in the Well, my main concern is that it very seldom makes sense for me to have the nice_names. I agree that this is fixed by changing the default, but of course we cannot do this immediately. Therefore i would have used the chance of introducing the aliases to give them already saner defaults and then transition the main calling points to those defaults over time. ie. i'd have my cake and eat it at the same time. But, well, i can live without that. |
They are global, but you could change them again after a couple of lines. A strict option isn't necessarily needed, but it would give you the option to ensure that the configuration isn't changed again. It might be too complicated, but we could make it very optional. My proposal above would give you the cake, isn't it? Either eat it all at once which is most robust, and go with the strict option. Or eat it over time, and change the defaults over time. And live with the deprecation warnings until then. |
I don't think that is very relevant.
And the cake would be: I make sure that my scripts have Yes, why not. Can do. |
|
alright, means we leave it like this? would say it makes the api a bit more consistent, and gives us an incentive to push v1.1 soon |
Let me release another patch with #1450 and then we merge all the v1.1 prs? |
Changes proposed in this Pull Request
Add
n.statsas an alternative alias to access statistics.Checklist
docs.docs/release-notes.mdof the upcoming release is included.