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
| @@ -86,6 +86,11 @@ Bookkeeping functions | |||
| .. versionchanged:: 3.2 | |||
| Moved to the version 2 scheme which uses all of the bits in a string seed. | |||
|
|
|||
| .. deprecated:: 3.9 | |||
| In the future, the *seed* must be one of the following types: | |||
| :class:`NoneType`, :class:`int`, :class:`float`, :class:`str`, | |||
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
There is no an entry for NoneType, so the link will not work.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Is float because of seed(time.time())?
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yes.
| elif not isinstance(a, (type(None), int, float, str, bytes, bytearray)): | ||
| _warn('Seeding based on hashing is deprecated\n' | ||
| 'since Python 3.9 and will be removed in a subsequent ' | ||
| 'version. The only \nsupported seed types are: None, ' |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I would break a string literal and a line after \n for readability
| possible seed value. Unfortunately, some of those types are not | ||
| guaranteed to have a deterministic hash value. After Python 3.9, | ||
| the module will restrict its seeds to *None*, :class:`int`, | ||
| :class:`float`, :class:`str`, :class:`bytes`, and :class:`bytearray'. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| :class:`float`, :class:`str`, :class:`bytes`, and :class:`bytearray'. | |
| :class:`float`, :class:`str`, :class:`bytes`, and :class:`bytearray`. |
|
Excuse my density and lateness, but why was this feature deprecated and removed instead of being fixed? Couldn't you use a non-random hash? The Python standard library already provides a wide variety of hashes in |
|
It is unrelated. |
Makes the following changes: - Added `float` to the `Union` for `Seed`. - Added `None` to the `Union` for `Seed`. - Replaced `Optional[Seed]` with `Seed` everywhere. See the following links for details: - https://bugs.python.org/issue32554 - python/cpython#15382 - https://docs.python.org/3.9/library/random.html#random.seed Currently `typeshed` is still using `Any`.
Makes the following changes: - Added `float` to the `Union` for `Seed`. - Added `None` to the `Union` for `Seed`. - Replaced `Optional[Seed]` with `Seed` everywhere. See the following links for details: - https://bugs.python.org/issue32554 - python/cpython#15382 - https://docs.python.org/3.9/library/random.html#random.seed Currently `typeshed` is still using `Any`.
Makes the following changes: - Added `float` to the `Union` for `Seed`. - Added `None` to the `Union` for `Seed`. - Replaced `Optional[Seed]` with `Seed` everywhere. See the following links for details: - https://bugs.python.org/issue32554 - python/cpython#15382 - https://docs.python.org/3.9/library/random.html#random.seed Currently `typeshed` is still using `Any`.
Makes the following changes: - Added `float` to the `Union` for `Seed`. - Added `None` to the `Union` for `Seed`. - Replaced `Optional[Seed]` with `Seed` everywhere. See the following links for details: - https://bugs.python.org/issue32554 - python/cpython#15382 - https://docs.python.org/3.9/library/random.html#random.seed Currently `typeshed` is still using `Any`.
Makes the following changes: - Added `float` to the `Union` for `Seed`. - Added `None` to the `Union` for `Seed`. - Replaced `Optional[Seed]` with `Seed` everywhere. See the following links for details: - https://bugs.python.org/issue32554 - python/cpython#15382 - https://docs.python.org/3.9/library/random.html#random.seed Currently `typeshed` is still using `Any`.
https://bugs.python.org/issue32554