Opened 10 years ago

Closed 10 years ago

#7320 closed defect (fixed)

search_src and friends are case-sensitive

Reported by: jhpalmieri Owned by: jhpalmieri
Priority: minor Milestone: sage-4.2.1
Component: misc Keywords:
Cc: mvngu Merged in: sage-4.2.1.alpha0
Authors: John Palmieri Reviewers: Karl-Dieter Crisman
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

The functions search_src, search_def, and search_src are case-sensitive and have been for a while. The documentation says that they're not. This patch changes the documentation to reflect this, and adds one doctest to verify it.

Attachments (2)

trac_7320-case-sensitive.patch (3.0 KB) - added by jhpalmieri 10 years ago.
trac_7320-case-sensitive.2.patch (3.2 KB) - added by kcrisman 10 years ago.
Fixes a few things, adds doctest - use this

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by jhpalmieri

comment:1 Changed 10 years ago by jhpalmieri

  • Status changed from new to needs_review

comment:2 follow-up: Changed 10 years ago by kcrisman

  • Cc mvngu added
  • Reviewers set to Karl-Dieter Crisman
  • Status changed from needs_review to positive_review

Just out of curiosity, is it possible to change the behavior? Obviously that would be a different ticket. That could be useful (or not). Maybe a function that is, and another one that isn't...

The new patch is just making the notation for "case-sensitive" uniformly with hyphen, which seemed to be the majority of references in the doc; however, usage in general seems quite variable. One word for the adjective seems right, though. Maybe mvngu will have a comment, so I'm cc:ing him on this.

I also added a little to the doctests to make sure we're really doctesting the right thing and compare the two possibilities.

Changed 10 years ago by kcrisman

Fixes a few things, adds doctest - use this

comment:3 in reply to: ↑ 2 Changed 10 years ago by jhpalmieri

Replying to kcrisman:

Just out of curiosity, is it possible to change the behavior? Obviously that would be a different ticket. That could be useful (or not). Maybe a function that is, and another one that isn't...

I think so: I think we can add a flag to the regular expression search to make it case-insensitive. We could add a flag (like ignore_case=False) to the search functions so people could toggle this. Of course, I haven't actually tried this, but the documentation for regular expression searches in Python suggests that it should be possible...

comment:4 Changed 10 years ago by mvngu

Replying to kcrisman:

Maybe mvngu will have a comment, so I'm cc:ing him on this.

Sometimes I want to search the source with case-sensitivity on. For example, I might be interested in knowing if the source has anything with the word "Euler" in it. As function and method names are lower-case, case-sensitivity search might not return the name of a function/method like "euler_phi". However, if the documentation for "euler_phi" has something like "Euler phi function" or "Euler totient function", then case-sensitivity search would pick up "Euler". Sometimes I want to do a case-insensitivity search. In that case (pun not intended), I would expect that both "euler_phi" and "Euler" be returned by the search. At the end of the day, one can make case-insensitivity search as default, but should also give people the option to do case-sensitivity search. My 2-cent.

comment:5 Changed 10 years ago by mhansen

  • Merged in set to sage-4.2.1.alpha0
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.