Skip to content
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

use less _element_constructor #36700

Merged
merged 3 commits into from
Dec 10, 2023
Merged

Conversation

fchapoton
Copy link
Contributor

@fchapoton fchapoton commented Nov 11, 2023

trying to avoid _element_constructor with no final underscore

the only serious change is the one in finite fields morphisms.

📝 Checklist

  • The title is concise, informative, and self-explanatory.
  • The description explains in detail what this PR is about.

@@ -71,7 +71,7 @@ class IncreasingChains(RecursivelyEnumeratedSet_forest):
self._greater_than = positions
self._vertices = list(range(n))

self._element_constructor = element_constructor
self._constructor_ = element_constructor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name _constructor_ so far does not appear anywhere in our codebase. Why is this an improvement?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it is now a specific name used only in this context, not related to any general mechanism

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why use _constructor_, not _constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better now ?

- ``element_constructor`` -- used to determine the type of chains,
for example ``list`` or ``tuple``
- ``constructor`` -- used to determine the type of chains,
for example :class:`list` or :class:`tuple`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be renamed without deprecation for the old name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not a named argument, just an argument

Copy link
Contributor

@mkoeppe mkoeppe Nov 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All arguments are named arguments unless you use , /,. Users can do D = IncreasingChains([{0,1},{1}], element_constructor=list, exclude=[]); D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have rename_keyword but only for keywords, not for args. If you insist, I can make an ad-hoc warning, but I would say it's ok not to deprecate. In particular, it's not in the global namespace.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the name of the parameter can just be left as is?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, done

Copy link

Documentation preview for this PR (built with commit f4a7f26; changes) is ready! 🎉

Copy link
Contributor

@mkoeppe mkoeppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

vbraun pushed a commit to vbraun/sage that referenced this pull request Dec 7, 2023
    
trying to avoid ` _element_constructor` with no final underscore

the only serious change is the one in finite fields morphisms.

### 📝 Checklist

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
    
URL: sagemath#36700
Reported by: Frédéric Chapoton
Reviewer(s): Frédéric Chapoton, Matthias Köppe
@vbraun vbraun merged commit 66e139d into sagemath:develop Dec 10, 2023
21 checks passed
@fchapoton fchapoton deleted the less_elt_constructor branch December 10, 2023 14:01
@mkoeppe mkoeppe added this to the sage-10.3 milestone Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants