[issue23677] Mention dict and set comps in library reference
New submission from Frank Millman: This is from the documentation at Section 4.6.4. Lists Lists may be constructed in several ways: Using a pair of square brackets to denote the empty list: [] Using square brackets, separating items with commas: [a], [a, b, c] Using a list comprehension: [x for x in iterable] Using the type constructor: list() or list(iterable) Comprehensions are mentioned as a constructor. This is from the documentation at Section 4.10. Mapping Types Dictionaries can be created by placing a comma-separated list of key: value pairs within braces, for example: {'jack': 4098, 'sjoerd': 4127} or {4098: 'jack', 4127: 'sjoerd'}, or by the dict constructor. class dict(**kwarg) class dict(mapping, **kwarg) class dict(iterable, **kwarg) Return a new dictionary initialized from an optional positional argument and a possibly empty set of keyword arguments. There is no mention of dictionary comprehensions. For consistency, I believe that the documentation for Dicts and Sets should mention comprehensions. -- assignee: docs@python components: Documentation messages: 238186 nosy: FrankMillman, docs@python priority: normal severity: normal status: open title: Mention dict and set comps in library reference versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23677 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23677] Mention dict and set comps in library reference
Frank Millman added the comment: Lists and tuples are described like this - class list([iterable]) Lists may be constructed in several ways: [...] class tuple([iterable]) Tuples may be constructed in a number of ways: [...] I think a similar approach to Dicts and Sets could make sense - class dict([**kwarg]) Dicts may be constructed in a number of ways: - Using a pair of braces to denote the empty dict: {} - Placing a comma-separated list of key: value pairs within braces: {'jack': 4098, 'sjoerd': 4127} or {4098: 'jack', 4127: 'sjoerd'} - Using a dict comprehension: {k: v for k, v in iterable} - Using the dict() built-in: dict() or dict(**kwarg) or dict(mapping, **kwarg) or dict(iterable, **kwarg) Add a new example - f = {k: v for k, v in [('one', 1), ('two', 2), ('three', 3)]} class set([iterable]) class frozenset([iterable]) Sets may be constructed in a number of ways: - Non-empty sets (not frozensets) can be created by placing a comma-separated list of elements within braces, for example: {'jack', 'sjoerd'} - Non-empty sets (not frozensets) can be created by using a set comprehension: {x for x in iterable} - Using the set() or frozenset() built-in The 'bullet-point' construction is not really necessary for Sets, but it would make it consistent with the others. A related point (I can raise a separate Issue if preferred) - For me, the power of comprehensions lies in their 'filtering' ability. This is not mentioned in any of the above examples, so newcomers may wonder why they should use them. We don't want to make the examples too complicated. Maybe just add 'if ...' to the example, and provide a cross-reference to Section 6.2.4 in the Language Reference (Displays for lists, sets and dictionaries). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23677 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26294] Queue().unfinished_tasks not in docs - deliberate?
New submission from Frank Millman: dir(queue.Queue()) shows an attribute 'unfinished_tasks'. It appears to be the counter referred to in the docs to 'join()', but it is not documented itself. I would like to make use of it, but I don't know if it is part of the official API for this module. Please advise. -- assignee: docs@python components: Documentation messages: 259645 nosy: docs@python, frankmillman priority: normal severity: normal status: open title: Queue().unfinished_tasks not in docs - deliberate? versions: Python 3.4, Python 3.5, Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26294> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26157] Typo in asyncio documentation
New submission from Frank Millman: 18.5.1.15. Server close() "The sockets that represent existing incoming client connections are leaved open." I think this should say 'are left open'. -- assignee: docs@python components: Documentation messages: 258599 nosy: docs@python, frankmillman priority: normal severity: normal status: open title: Typo in asyncio documentation versions: Python 3.5, Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26157> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29062] Documentation link error
New submission from Frank Millman: If you call up online documentation for Python3.6, and select modules>h>hashlib, it takes you to 15.2. hashlib — BLAKE2 hash functions It should take you to 15.1. hashlib — Secure hashes and message digests -- assignee: docs@python components: Documentation messages: 283930 nosy: docs@python, frankmillman priority: normal severity: normal status: open title: Documentation link error type: behavior versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29062> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35007] Minor change to weakref docs
New submission from Frank Millman : weakref.WeakKeyDictionary.keyrefs() - The documentation says 'Return an iterable of the weak references to the keys'. I was not sure if this would expose me to the 'dictionary changed size while iterating' error, so I checked the source. The source shows that it returns a list, and the docstring says 'Return a list of weak references to the keys'. I suggest that the documentation be changed to match the docstring. The same applies to valuerefs(). -- assignee: docs@python components: Documentation messages: 327863 nosy: docs@python, frankmillman priority: normal severity: normal status: open title: Minor change to weakref docs type: behavior versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue35007> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1152] Bug in documentation for SimpleXMLRPCServer
New submission from Frank Millman: I spotted a minor bug in the documentation to SimpleXMLRPCServer. Background: xmlrpclib.py has the following - # This class is available as ServerProxy and Server. New code should # use ServerProxy, to avoid confusion. # ... class ServerProxy: ... Server = ServerProxy The bug: Section 18.25.1 SimpleXMLRPCServer Objects ... Example: ... The following client code will call the methods made available by the preceding server: import xmlrpclib s = xmlrpclib.Server('http://localhost:8000') It should say: s = xmlrpclib.ServerProxy('http://localhost:8000') -- components: Documentation messages: 55836 nosy: FrankMillman severity: normal status: open title: Bug in documentation for SimpleXMLRPCServer versions: Python 2.5 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1152 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7688] TypeError: __name__ must be set to a string object
New submission from Frank Millman fr...@chagford.com: At the top of my program I have 'from __future__ import unicode_literals'. The relevant lines from my program read - from multiprocessing.managers import BaseManager class MyManager(BaseManager): pass MyManager.register('my_function', my_function) In multiprocessing.managers.py, the following lines are executed - 605 @classmethod 606 def register(cls, typeid, ...) [...] 632 def temp(...): [...] 642 temp.__name__ = typeid At this point, Python raises the exception TypeError: __name__ must be set to a string object I can fix it by changing my last line to - MyManager.register(str('my_function'), my_function) Is it possible to allow __name__ to be a unicode object? If not, may I suggest that line 642 of managers.py is changed to - temp.__name__ = str(typeid) Frank Millman -- components: Library (Lib) messages: 97697 nosy: frankmillman severity: normal status: open title: TypeError: __name__ must be set to a string object type: crash versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7688 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7571] Change 'name' of Process - assertion failure if Unicode
New submission from Frank Millman fr...@chagford.com: At the top of my program, I have 'from __future__ import unicode_literals'. I subclassed Process, and passed name='test' as an argument. I got the following traceback. Traceback (most recent call last): File F:\junk\multiprocess\mp5.py, line 37, in module p = Frank(name='test') File F:\junk\multiprocess\mp5.py, line 18, in __init__ self.name = name File C:\Python26\lib\multiprocessing\process.py, line 141, in name assert isinstance(name, str), 'name must be a string' AssertionError: name must be a string If I change the argument to name=str('test') there is no error. For Python 2.x I think the assertion should be isinstance(name, basestring) to prevent this from happening. -- components: Library (Lib) messages: 96849 nosy: frankmillman severity: normal status: open title: Change 'name' of Process - assertion failure if Unicode type: behavior versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7571 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14720] sqlite3 microseconds
New submission from Frank Millman fr...@chagford.com: sqlite3/dbapi2.py contains the following - def convert_timestamp(val): datepart, timepart = val.split(b ) timepart_full = timepart.split(b.) [...] if len(timepart_full) == 2: microseconds = int(timepart_full[1]) else: microseconds = 0 It assumes that 'timepart_full[1]' is a string containing 6 digits. I have a situation where the string containing 3 digits, so it gives the wrong result. For example, if the string is '456', this represents 456000 microseconds, but sqlite3 returns 456 microseconds. I think that it should right-zero-fill the string to 6 digits before converting to an int, like this - microseconds = int('{:06}'.format(timepart_full[1])) -- components: Library (Lib) messages: 159905 nosy: frankmillman priority: normal severity: normal status: open title: sqlite3 microseconds type: behavior versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14720 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20791] copy.copy(bytes) is slow
New submission from Frank Millman: Using copy.copy on a byte string returns a new copy instead of the original immutable object. Using copy.deepcopy returns the original, as expected. Testing with timeit, copy.copy is much slower than copy.deepcopy. import copy a = 'a'*1000 # string copy.copy(a) is a True copy.deepcopy(a) is a True b = b'b'*1000 # bytes copy.copy(b) is b False copy.deepcopy(b) is b True -- components: Library (Lib) messages: 212340 nosy: frankmillman priority: normal severity: normal status: open title: copy.copy(bytes) is slow type: performance versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20791 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com