-
-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add case sensitive to global options #14248
Comments
Changed keywords from none to global options |
comment:2
For all the non-Americans out there: "Entree" is the name for the main course in `Murrica |
comment:4
Hi Travis, Sorry, have been meaning to review this for a while as well... I just looked over the code and values_case doesn't seem very meaningful to me. I think that it would be better to have optional argument case_sensitive which is either True or False, with whatever default you think reasonable. I guess with your patch you allow the options to be forced to be either upper case, lower case, or to be case sensitive. Perhaps this is better than simply case sensitive or insensitive. Given that I was happy to always enforce lower case I am perhaps not the best person to comment on what is best here! Will be happy to finalise a review once some one else comments on this. Andrew |
comment:5
I like I also think that in automatically generated documentation things should show as entered no matter whether the case is forced or not, i.e. if I have in my code "English", it should show in documentation as "English" even if we accept "english" as well. |
comment:6
My original thought on giving both options was in case someone wanted to force lower/uppercase display. Although this ticket came about because of #2023 in which I needed to have the ability to leave it as uppercase. Instead what we could do is have a second parameter
So for things like convention, we'd use value since we'd want English and French to display and to turn off case sensitivity for checking input. Does this sound like a better solution? Actually I wonder if we should put something in the autogen doc about case sensitivity. On that note about autogen doc, it should not reflect the code, but instead the displayed value. That is what the user sees, and it would be more trouble explaining why the doc says "English" while the outputted option is always "english" IMO. (My principle is that if you're coding it, you "know" what you're doing, but typically the user does not.) Best, Travis |
comment:7
Replying to @tscrim:
I think that we should keep it as simple as possible: using two parameters to control this strikes me as being a little OTT. In light of Andrey's comments I vote for having case_sensitive=True/False and also following Travis's suggestion that the case of the default value is preserved in the documentation. I think that this is the most intuitive approach and that it also meets Travis' requirements for #2023. In terms of the code, it is easy to make it appear to the user that the default version of the option, together with its supplied choice of case, is always being used even though the option may not be case sensitive. Btw, I am fairly sure that the documentation already does mention that all options are forced to be lower case. When I do the review I'll go through and fix up some of the many typos that are there and also make sure that this is addressed. Andrew |
comment:8
Would it be too painful to make "keep as is" the default? All of python, and in particular string matching, is normally fully case sensitive. It feels very strange that this is not, even if it might be considered convenient by some. In particular, by the time someone is setting options he/she is a stage beyond "beginner" and they'll have to look up the name of the option anyway, so I don't think in practice the convenience will really matter. In most of python, ambiguity about case is removed by preferring all-lower-case. (I know, singletons Incidentally, the need for options has a code smell to me: I'd start to look for a design flaw if I felt the need to introduce one. |
comment:9
Replying to @nbruin:
No, it would not be painful. In fact this is what is being suggested above.
This is what is currently done.
Disagree on this one - I guess you don't use bashrc files etc? I think that options are useful for either reflecting user preferences (for example, changing how something is displayed, often corresponding to different conventions in the literature), or for controlling parameters to a class (for example, see the options used in #13131 - which isn't using GlobalOptions, but could). |
comment:10
Here's a new version of the patch which gives the option for case sensitivity as per the discussion. The implementation (if anyone cares) is easily extendable to what I was originally suggesting if it is decided to go that route (also this was the easiest way I could think of to do the implementation). |
comment:11
I notice the patch makes a few of the options of partitions and tableaux case sensitive but to me it is not obvious why some are and some aren't. Could you please explain the rationale for this? Certainly having some options being case sensitive and others not in a class of options is potentially confusing...perhaps case sensitivity should apply to all of the options so that they are either all case sensitive or all not. |
comment:12
The reason why the options for partitions are not case sensitive is because they are tied to the output (and they don't have a set of possible values). You don't want to be outputting I don't want all options to be case (in)sensitive for this reason. |
comment:13
New patch which fixes output bug in |
Review patch which fixes some doc-strings and makes case_sensitive a boolean |
comment:14
Attachment: trac_14248-global_options_case-review--am.patch.gz Hi Travis, I finally got around to reviewing this. The attached review patch, which is also in the queue, fixes number of doc-string problems (most of which predate your patch) and makes case_sensitive into a proper boolean. The patch is also in the combinat queue. Please have a look at the review patch. If you're happy with this then I'll make this a positive review. Andrew |
comment:15
Hey Andrew, Thank you for doing the reviews. However I think these should be case-sensitive by default, and so line 777 should be
This would also match with the documentation and typical (python) code semantics. Best, Travis |
comment:16
Replying to @tscrim:
Yes, sorry, I agree. |
Attachment: trac_14248-global_options_case-ts.patch.gz |
This comment has been minimized.
This comment has been minimized.
comment:17
Hey Andrew, I've uploaded the patch which has your review patch folded in and makes the minor tweak above. I'm setting this to positive review since we're in agreement about the patch (please correct me if I'm wrong). Thank you again for reviewing this, Travis For patchbot: Apply: trac_14249-global_options_case-ts.patch |
comment:18
Replying to @tscrim:
Yes, that's good: it should be a positive review. I didn't set it to a positive review because I noticed that the review patch, with the proper defaults, wasn't yet on trac. |
This comment has been minimized.
This comment has been minimized.
comment:19
I'm not able to overwrite files the you've uploaded and wasn't sure if you were going to do it in the review patch or not. Anyways...we're done. Yay! |
Reviewer: Andrew Mathas |
Merged: sage-5.10.beta2 |
Currently all string values are converted to lowercase in global options, so checks are case insensitive. This will add an option to allow case distinctions.
Apply:
Depends on #13605
CC: @sagetrac-sage-combinat @nthiery @AndrewAtLarge @novoselt
Component: misc
Keywords: global options
Author: Travis Scrimshaw
Reviewer: Andrew Mathas
Merged: sage-5.10.beta2
Issue created by migration from https://trac.sagemath.org/ticket/14248
The text was updated successfully, but these errors were encountered: