-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
Conversation
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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` |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, done
2e082a9
to
3e54704
Compare
Documentation preview for this PR (built with commit f4a7f26; changes) is ready! 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
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
trying to avoid
_element_constructor
with no final underscorethe only serious change is the one in finite fields morphisms.
📝 Checklist