[issue20606] Operator Documentation Example doesn't work

2015-01-04 Thread Gareth Rees
Gareth Rees added the comment: This is a duplicate of #22180, which was fixed in changeset 9c250f34bfa3 by Raymond Hettinger in branch '3.4'. The fix just removes the bad example, as in my patch. So I suggest that this issue be closed as a

[issue24405] Missing code markup in "Expressions" documentation

2015-06-08 Thread Gareth Rees
New submission from Gareth Rees: The "Expressions" documentation contains the text: > * Sets and frozensets define comparison operators to mean subset and superset > tests. Those relations do not define total orderings (the two sets ``{1,2}`` > and {2,3} are not equal,

[issue24406] "Bulit-in Types" documentation doesn't explain how dictionaries are compared for equality

2015-06-08 Thread Gareth Rees
New submission from Gareth Rees: The "Built-in Types" section of the library documentation does not explain how two dictionaries are compared for equality. The place where this is documented is under "Comparisons" in the Language Reference: > Mappings (dictionaries) co

[issue24406] "Built-in Types" documentation doesn't explain how dictionaries are compared for equality

2015-06-08 Thread Gareth Rees
Changes by Gareth Rees : -- title: "Bulit-in Types" documentation doesn't explain how dictionaries are compared for equality -> "Built-in Types" documentation doesn't explain how dictionaries are compared for equality

[issue24460] urlencode() of dictionary not as expected

2015-06-17 Thread Gareth Rees
Gareth Rees added the comment: If you read the documentation for urllib.parse.urlencode [1], you'll see that it says: The value element in itself can be a sequence and in that case, if the optional parameter doseq is evaluates to True, individual key=value pairs separated by &#

[issue24067] Weakproxy is an instance of collections.Iterator

2015-04-28 Thread Gareth Rees
Gareth Rees added the comment: Not just Iterator, but Container, Hashable, Iterable, and Sized too! >>> import weakref >>> class C: pass >>> o = C() >>> w = weakref.proxy(o) >>> from collections.abc import * >>>

[issue24067] Weakproxy is an instance of collections.Iterator

2015-04-28 Thread Gareth Rees
Gareth Rees added the comment: Hashable is particularly misleading, because "weakref.Proxy objects are not hashable regardless of the referent". -- ___ Python tracker <http://bugs.python.o

[issue24067] Weakproxy is an instance of collections.Iterator

2015-04-28 Thread Gareth Rees
Gareth Rees added the comment: The documentation says that weakref.Proxy objects are not hashable because "this avoids a number of problems related to their fundamentally mutable nature, and prevent their use as dictionary keys". Hashable objects must be immutable, otherwise the

[issue24067] Weakproxy is an instance of collections.Iterator

2015-04-28 Thread Gareth Rees
Gareth Rees added the comment: > I don't see any reason for proxy objects to be less hashable than ref objects. The difference is that unlike a ref object, a proxy object is supposed to forward its method calls to the proxied object. So consider what happens if you forward the __hash_

[issue28647] python --help: -u is misdocumented as binary mode

2016-11-12 Thread Gareth Rees
Gareth Rees added the comment: The output of "python3.5 --help" says: -u : unbuffered binary stdout and stderr, stdin always buffered; also PYTHONUNBUFFERED=x see man page for details on internal buffering relating to '-u' If you look at the man pag

[issue28647] python --help: -u is misdocumented as binary mode

2016-11-12 Thread Gareth Rees
Gareth Rees added the comment: Here's a patch that copies the text for the -u option from the man page to the --help output. -- keywords: +patch Added file: http://bugs.python.org/file45463/issue28647.patch ___ Python tracker

[issue28676] On macOS Sierra, warning: implicit declaration of function 'getentropy'

2016-11-12 Thread Gareth Rees
New submission from Gareth Rees: On macOS Sierra (OSX 10.12.1): $ ./configure --with-pydebug && make [... lots of output omitted ...] gcc -c -Wno-unused-result -Wsign-compare -g -O0 -Wall -Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno

[issue28690] Loop in re (regular expression) processing

2016-11-14 Thread Gareth Rees
Gareth Rees added the comment: This is a well-known gotcha with backtracking regexp implementations. The problem is that in the alternation "( +|'[^']*'|\"[^\"]*\"|[^>]+)" there are some characters (space, apostrophe, double quotes) that match

[issue28743] test_choices_algorithms() in test_random uses lots of memory

2016-11-19 Thread Gareth Rees
Gareth Rees added the comment: Couldn't the test case use something like this to avoid allocating so much memory? from collections.abc import Sequence class RepeatedSequence(Sequence): """Immutable sequence of n repeats of elem."""

[issue28743] test_choices_algorithms() in test_random uses lots of memory

2016-11-19 Thread Gareth Rees
Gareth Rees added the comment: In order for this to work, the __getitem__ method needs to be: def __getitem__(self, key): if 0 <= key < self.n: return self.elem else: raise IndexError(key) But unfortunately this is very bad for the performance

<    1   2