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
documentation: numbers module nitpick #76314
Comments
Documentation of the numbers module: This is true for Complex, Real, Rational, Integral but not for Number: >>> numbers.Number()
<numbers.Number object at 0x7fcccc71f3c0>
>>> numbers.Real()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Can't instantiate abstract class Real... Since Number doesn't have any abstract methods, the correct fix seems to be changing the documentation. I would try to convey something like this: "The types defined in this module can be used for subclassing and checking whether a specific class is in the numeric hierarchy; they are not used directly for instantiation. For this, you can use types such as |
Seen that nobody is working on this I transformed the suggestion into a PR. |
I would like work on this, but I'm very new to fixing bugs. Could someone please help me on how to proceed with this bug. Thank You in advance |
Here's a minimal change:
|
@rhettinger added your suggestion. |
Maybe some methods from the Complex class could be moved to the Number class? I think, that something like the ring structure (probably even a commutative ring) is expected from the number classes in the Python. I.e. there should be __add__/sub/mul/pos/neg/pow/etc. But not __truediv__/floordiv. Even simpler idea: move the __eq__ method to the Number class. Then it would be impossible to instantiate a Number. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: