| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -942,7 +942,10 @@ set_update(PySetObject *so, PyObject *args) | |
| } | ||
|
|
||
| PyDoc_STRVAR(update_doc, | ||
| "Update a set with the union of itself and others."); | ||
| "update($self, /, *others)\n\ | ||
| --\n\ | ||
| \n\ | ||
| Update the set, adding elements from all others."); | ||
|
|
||
| /* XXX Todo: | ||
| If aligned memory allocations become available, make the | ||
| Expand Down Expand Up | @@ -1141,9 +1144,10 @@ set_union(PySetObject *so, PyObject *args) | |
| } | ||
|
|
||
| PyDoc_STRVAR(union_doc, | ||
| "Return the union of sets as a new set.\n\ | ||
| "union($self, /, *others)\n\ | ||
| --\n\ | ||
| \n\ | ||
| (i.e. all elements that are in either set.)"); | ||
| Return a new set with elements from the set and all others."); | ||
|
|
||
| static PyObject * | ||
| set_or(PySetObject *so, PyObject *other) | ||
| Expand Down Expand Up | @@ -1281,9 +1285,10 @@ set_intersection_multi(PySetObject *so, PyObject *args) | |
| } | ||
|
|
||
| PyDoc_STRVAR(intersection_doc, | ||
| "Return the intersection of two sets as a new set.\n\ | ||
| "intersection($self, /, *others)\n\ | ||
| --\n\ | ||
| \n\ | ||
| (i.e. all elements that are in both sets.)"); | ||
| Return a new set with elements common to the set and all others."); | ||
|
|
||
| static PyObject * | ||
| set_intersection_update(PySetObject *so, PyObject *other) | ||
| Expand Down Expand Up | @@ -1312,7 +1317,10 @@ set_intersection_update_multi(PySetObject *so, PyObject *args) | |
| } | ||
|
|
||
| PyDoc_STRVAR(intersection_update_doc, | ||
| "Update a set with the intersection of itself and another."); | ||
| "intersection_update($self, /, *others)\n\ | ||
| --\n\ | ||
| \n\ | ||
| Update the set, keeping only elements found in it and all others."); | ||
|
|
||
| static PyObject * | ||
| set_and(PySetObject *so, PyObject *other) | ||
| Expand Down Expand Up | @@ -1470,7 +1478,10 @@ set_difference_update(PySetObject *so, PyObject *args) | |
| } | ||
|
|
||
| PyDoc_STRVAR(difference_update_doc, | ||
| "Remove all elements of another set from this set."); | ||
| "difference_update($self, /, *others)\n\ | ||
| --\n\ | ||
| \n\ | ||
| Update the set, removing elements found in others."); | ||
|
|
||
| static PyObject * | ||
| set_copy_and_difference(PySetObject *so, PyObject *other) | ||
| Expand Down Expand Up | @@ -1587,9 +1598,10 @@ set_difference_multi(PySetObject *so, PyObject *args) | |
| } | ||
|
|
||
| PyDoc_STRVAR(difference_doc, | ||
| "Return the difference of two or more sets as a new set.\n\ | ||
| "difference($self, /, *others)\n\ | ||
| --\n\ | ||
| \n\ | ||
| (i.e. all elements that are in this set but not the others.)"); | ||
| Return a new set with elements in the set that are not in the others."); | ||
| static PyObject * | ||
| set_sub(PySetObject *so, PyObject *other) | ||
| { | ||
| Expand Down Expand Up | @@ -1673,7 +1685,10 @@ set_symmetric_difference_update(PySetObject *so, PyObject *other) | |
| } | ||
|
|
||
| PyDoc_STRVAR(symmetric_difference_update_doc, | ||
| "Update a set with the symmetric difference of itself and another."); | ||
| "symmetric_difference_update($self, other, /)\n\ | ||
| --\n\ | ||
| \n\ | ||
| Update the set, keeping only elements found in either set, but not in both."); | ||
|
|
||
| static PyObject * | ||
| set_symmetric_difference(PySetObject *so, PyObject *other) | ||
| Expand All | @@ -1694,9 +1709,10 @@ set_symmetric_difference(PySetObject *so, PyObject *other) | |
| } | ||
|
|
||
| PyDoc_STRVAR(symmetric_difference_doc, | ||
| "Return the symmetric difference of two sets as a new set.\n\ | ||
| "symmetric_difference($self, other, /)\n\ | ||
| --\n\ | ||
| \n\ | ||
| (i.e. all elements that are in exactly one of the sets.)"); | ||
| Return a new set with elements in either the set or other but not both."); | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityBTW, for other set methods it seems there are signatures. But... An example: >>> help(set.add)
Help on method_descriptor:
add(self, object, /)
Add an element to a set.
This has no effect if the element is already present.
c.f. the sphinx docs: add(elem)
Add element elem to the set.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualitySignatures for methods without arguments and with a single positional argument are now autogenerated.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityAnyway, this looks like a bug.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityWhat exactly?
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI was hoping is obvious. Instead of mystic name object, I would expect something like this >>> inspect.signature(set.add)
<Signature (self, element, /)>
>>> help(set.add)
Help on method_descriptor:
add(self, element, /)
Add an element to a set.
This has no effect if the element is already present.I realize, parameter name here is not a part of API, but I think it should be meaningful, if possible.
Sorry, something went wrong.
AlexWaygood reacted with thumbs up emoji
All reactions
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityIt could be improved, but it is not a bug. You can add explicit signatures for these methods, but for me it has low priority. I worked on support of multi-signatures, and this PR is a side product, the improvements that do not need multi-signatures (with multi-signatures and autogenerated signatures almost 100% of builtin functions and classes will have signatures).
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI think 'object', an instance of the base object class, is as correct as 'element', which is a set-theory specific synonym. We might say that 'a list has items', but item is a synonym for object. Here also, I appreciate the technically correct list.append(self, object, /). I think the consistency of the auto-generated signatures is good.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityOne could argue that it should be set.add(self, hashable), as not any object can be added, whereas any object can be appended. The math term 'element' does not imply the restriction any more than 'object'.
Sorry, something went wrong.
All reactions
|
||
|
|
||
| static PyObject * | ||
| set_xor(PySetObject *so, PyObject *other) | ||
| Expand Down Expand Up | @@ -2100,8 +2116,8 @@ static PyNumberMethods set_as_number = { | |
| }; | ||
|
|
||
| PyDoc_STRVAR(set_doc, | ||
| "set() -> new empty set object\n\ | ||
| set(iterable) -> new set object\n\ | ||
| "set(iterable=(), /)\n\ | ||
| --\n\ | ||
| \n\ | ||
| Build an unordered collection of unique elements."); | ||
|
|
||
| Expand Down Expand Up | @@ -2201,8 +2217,8 @@ static PyNumberMethods frozenset_as_number = { | |
| }; | ||
|
|
||
| PyDoc_STRVAR(frozenset_doc, | ||
| "frozenset() -> empty frozenset object\n\ | ||
| frozenset(iterable) -> frozenset object\n\ | ||
| "frozenset(iterable=(), /)\n\ | ||
| --\n\ | ||
| \n\ | ||
| Build an immutable unordered collection of unique elements."); | ||
|
|
||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualitySphinx docs shows this as bool(x=False) (give impression that this is a positional-or-keyword argument). Probably, this should be adjusted too?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityMaybe in other issue. The documentation not always uses syntax for positional-only parameters. It is relatively new.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.