Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ENH: adding suggested names to ColormapRegistry missing key error#28115

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

tacaswell
Copy link
Member

difflib.get_close_match has been in the standard library from Python 2.1

PR summary

Make use of a function in the standard library to give suggestions for missed

PR checklist

I don't think this needs to be called out in the release notes.

difflib.get_close_match has been in the standard library from Python 2.1
@anntzer
Copy link
Contributor

(We don't have to do this now; just leaving a comment as a note.) It would be nice to be able to reuse CPython's attribute suggestions algorithm, but it looks like it's not exposed externally (other than calling excepthook and parsing stderr...); see alsoipython/ipython#13445 (ipython having to reimplement it).

@tacaswell
Copy link
MemberAuthor

Ah, I thought this was cpython's suggestion algorithm.

Maintains the status-quoCo-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
@tacaswell
Copy link
MemberAuthor

For reference, cpython appears to use Levenshtein distance (python/cpython@37494b4#diff-aad873b2c81d05628e415ef526dbd8845ebe4bf85b2d9c6d83d6cdf804b6e7b7) where asdifflibe.get_close_matches uses a different (more general?) algorithm.

It looks liketraceback has a (private) implementation of Levenshtein distance, but given that using private methods makes Guido sad (and makes us sad when people use our private API) we should not do that.

I think the reasonable options are:

  • stick with difflib
  • vendor a copy of Levenshtein distance (CPython's implementation is only 60 lines with comments)

@tacaswelltacaswell marked this pull request as draftApril 24, 2024 02:36
@tacaswell
Copy link
MemberAuthor

I'm leaning to

  • vendor Levenshtein
  • use it in check_list

which means a bunch more work. I'll try to get back to this, but if someone wants to take this over I will not be mad!

@QuLogic
Copy link
Member

Would that produce better results?

@timhoffm
Copy link
Member

Yes, what's the difference? If difflib gives reasonable results. I would stick with that as "good enough" before writing/vendoring any additional code.

rcomer reacted with thumbs up emoji

@tacaswell
Copy link
MemberAuthor

Closing in favor of#30001

@tacaswelltacaswell removed this from thev3.11.0 milestoneMay 4, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@story645story645story645 left review comments

@timhoffmtimhoffmtimhoffm left review comments

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@tacaswell@anntzer@QuLogic@timhoffm@story645@ksunden

[8]ページ先頭

©2009-2025 Movatter.jp