New submission from Dimitri Papadopoulos Orfanos :
The documentation of sorted() lacks any reference to the comparison mechanism
between items.
Compare with the documentation of list.sort(), which starts with:
using only < comparisons between items
This is mentioned in the "Sor
Change by Dimitri Papadopoulos Orfanos :
--
keywords: +patch
pull_requests: +26871
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/28472
___
Python tracker
<https://bugs.python.org/issu
Dimitri Papadopoulos Orfanos added the comment:
Then what about removing it from the list.sort() documentation too?
Note that maintainers of other PEPs insist that this is a known fact and base
their code on that:
https://github.com/python/peps/pull/2077
Dimitri Papadopoulos Orfanos added the comment:
I would recommend the wording in the "Sorting HOW TO" from:
The sort routines are guaranteed to use __lt__() when making comparisons
between two objects.
to:
The sort routines happen to use __lt__() when making comparisons be
Dimitri Papadopoulos Orfanos added the comment:
I've seen the new PR for sorted(), thank you for looking into this.
Would it make sense to change list.sort() in the same way?
--
___
Python tracker
<https://bugs.python.org/is
New submission from Dimitri Papadopoulos Orfanos :
The fnmatch documentation should explicitly mention the type of exceptions
raised by fnmatch.fnmatch():
https://docs.python.org/3/library/fnmatch.html
In my case it raised sre_constants.error, and it took some time to understand
that the
Dimitri Papadopoulos Orfanos added the comment:
I agree on avoiding a link to str.isspace() and defining "whitespace" instead.
However please note there are many de facto definitions of "whitespace". All of
them must be documented - or at least the conceptual classes
New submission from Dimitri Papadopoulos Orfanos:
The documentation of strip() / lstrip() / rstrip() should define "whitespace"
more precisely.
The Python 3 documentation refers to "ASCII whitespace" for bytes.strip() /
bytes.lstrip() / bytes.rstrip() and "
New submission from Dimitri Papadopoulos Orfanos:
About section "7.2.1. Methods of File Objects" of the tutorial:
1. Method read() is documented as follows:
reads some quantity of data and returns it as a string or bytes object.
Indeed read() returns a string in text mode and bytes
Dimitri Papadopoulos Orfanos added the comment:
In Python 2, as far as I can understand, string.whitespace and str.isspace()
are different:
* str.isspace() is built upon the C isspace() function and is therefore
locale-dependant. Python heavily relies on isspace() to detect "white
Dimitri Papadopoulos Orfanos added the comment:
In Python 3 the situation is similar:
* The Py_UNICODE_ISSPACE macro is used internally to define str.isspace() and
wherever Python needs to detect "whitespace" characters in strings.
* There is an equivalent function Py_ISSPACE
11 matches
Mail list logo