[issue36144] Dictionary addition. (PEP 584)

2019-12-12 Thread Aaron Hall
Aaron Hall added the comment: Another obvious way to do it, but I'm +1 on it. A small side point however - PEP 584 reads: > To create a new dict containing the merged items of two (or more) dicts, one > can currently write: > {**d1, **d2} > but this is neither obviou

[issue36927] traceback docstrings should explicitly state return values instead of referring to other functions

2019-05-15 Thread Aaron Hall
New submission from Aaron Hall : I've written three (or more) answers on Stack Overflow about how to use the functions in the traceback module, and I code Python all day long. Embarrassing confession: I just recommended the wrong traceback function in email to fix the incorrect usage

[issue34648] Confirm the types of parameters of traceback.format_list and traceback.StackSummary.from_list post-3.5

2019-05-15 Thread Aaron Hall
Change by Aaron Hall : -- nosy: +Aaron Hall ___ Python tracker <https://bugs.python.org/issue34648> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-07 Thread Aaron Hall
Change by Aaron Hall : -- nosy: +Aaron Hall ___ Python tracker <https://bugs.python.org/issue36551> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35625] Comprehension doc doesn't mention buggy class scope behavior

2019-04-03 Thread Aaron Hall
Change by Aaron Hall : -- nosy: +Aaron Hall ___ Python tracker <https://bugs.python.org/issue35625> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31753] Unnecessary closure in ast.literal_eval

2019-03-20 Thread Aaron Hall
Aaron Hall added the comment: No need to keep this open, I agree with the core developers this shouldn't be changed. -- status: open -> closed ___ Python tracker <https://bugs.python.org/issu

[issue26103] Contradiction in definition of "data descriptor" between (dotted lookup behavior/datamodel documentation) and (inspect lib/descriptor how-to)

2019-03-20 Thread Aaron Hall
Change by Aaron Hall : -- stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue26103> ___ ___ Pyth

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-24 Thread Aaron Hall
Change by Aaron Hall : -- nosy: +Aaron Hall ___ Python tracker <https://bugs.python.org/issue35059> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue12154] PyDoc Partial Functions

2018-05-28 Thread Aaron Hall
Aaron Hall added the comment: Should pydoc treat a partial object like a function? Should a partial be an instance of a function? Should we be able to add all the nice things that functions have to it? If we want that, should we simply instantiate a function the normal way, with a new

[issue30129] functools.partialmethod should look more like what it's impersonating.

2018-05-28 Thread Aaron Hall
Change by Aaron Hall : -- nosy: +Aaron Hall ___ Python tracker <https://bugs.python.org/issue30129> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32400] inspect.isdatadescriptor false negative

2018-05-22 Thread Aaron Hall
Change by Aaron Hall <aaronch...@yahoo.com>: -- nosy: +Aaron Hall ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32400> ___ _

[issue25457] json dump fails for mixed-type keys when sort_keys is specified

2018-05-21 Thread Aaron Hall
Aaron Hall <aaronch...@yahoo.com> added the comment: >From a design standpoint, I'm fairly certain the sort_keys argument was >created due to Python's dicts being arbitrarily ordered. Coercing to strings before sorting is unsatisfactory because, e.g. numbers sort lexicographic

[issue25457] json dump fails for mixed-type keys when sort_keys is specified

2018-05-20 Thread Aaron Hall
Aaron Hall <aaronch...@yahoo.com> added the comment: Now that dicts are sortable, does that make the sort_keys argument redundant? Should this bug be changed to "won't fix"? ------ nosy: +Aaron Hall ___ Python tracker <rep...@bugs

[issue33498] pathlib.Path wants an rmtree method

2018-05-15 Thread Aaron Hall
Aaron Hall <aaronch...@yahoo.com> added the comment: > What is wrong with just using shutil.rmtree()? 0. It's awkward to import just for demonstrations. 1. It's harder for new pythonists to discover. 2. A method provides discoverability in an object's namespace. 3. rmtree is a method

[issue33498] pathlib.Path wants an rmtree method

2018-05-14 Thread Aaron Hall
New submission from Aaron Hall <aaronch...@yahoo.com>: pathlib.Path wants the rmtree method from shutil I think we need this method for a couple of reasons. 1. in shell, rm has the -r flag - In Python, we use shutil.rmtree as a best practice for this. 2. I prefer to teach my students

[issue30670] pprint for dict in sorted order or insert order?

2017-11-02 Thread Aaron Hall
Aaron Hall <aaronch...@yahoo.com> added the comment: If/when order is guaranteed (3.7?) we should have a pprint that respects current order, -or- we should get an improved pprint (maybe named pp or print?) that understands mappings and other abstract data types. I had a conversation

[issue31753] Unnecessary closure in ast.literal_eval

2017-10-17 Thread Aaron Hall
Aaron Hall <aaronch...@yahoo.com> added the comment: New information: I think I have pinpointed at least a contributor to the difference - closure lookups seem to be currently slightly slower (by a few percent) than global lookups (see https://stackoverflow.com/a/46798876/541136). And

[issue31753] Unnecessary closure in ast.literal_eval

2017-10-17 Thread Aaron Hall
Aaron Hall <aaronch...@yahoo.com> added the comment: Static analysis: My mental model currently says the rebuilt function every outer call is an expense with no offsetting benefit. It seems that a function shouldn't build a closure on every call if the closure doesn't close over an

[issue31753] Unnecessary closure in ast.literal_eval

2017-10-11 Thread Aaron Hall
Aaron Hall <aaronch...@yahoo.com> added the comment: So... moving the closure (which may be called recursively) to the global scope actually does improve performance (for small cases, about 10% - larger cases amortize the cost of the closure being built, but in a 100 item dictionary,

[issue31753] Unnecessary closure in ast.literal_eval

2017-10-10 Thread Aaron Hall
Aaron Hall <aaronch...@yahoo.com> added the comment: Rejecting and withdrawing with apologies. -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker <rep...@bugs.python.org> <https://bu

[issue31753] Unnecessary closure in ast.literal_eval

2017-10-10 Thread Aaron Hall
New submission from Aaron Hall <aaronch...@yahoo.com>: Removing the closure seems to make the function about 10% faster. Original source code at: https://github.com/python/cpython/blob/3.6/Lib/ast.py#L40 Empirical evidence: astle.py import timeit from ast import litera

[issue28972] Document all "python -m" utilities

2017-09-09 Thread Aaron Hall
Aaron Hall added the comment: I like this idea too, but perhaps it should just be a multi-column bulleted list (under the -m flag at https://docs.python.org/3/using/cmdline.html#interface-options) with links to the respective Standard Library doc? Then we just ensure the documentation

[issue26103] Contradiction in definition of "data descriptor" between (dotted lookup behavior/datamodel documentation) and (inspect lib/descriptor how-to)

2017-09-03 Thread Aaron Hall
Aaron Hall added the comment: Serhiy, Not sure what else needs to be done to wrap this up. All checks are passing on the pull request. Thoughts? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue31319] Rename idlelib to just idle

2017-09-03 Thread Aaron Hall
Changes by Aaron Hall <aaronch...@yahoo.com>: -- nosy: +Aaron Hall ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31319> ___ _

[issue31333] Implement ABCMeta in C

2017-09-03 Thread Aaron Hall
Changes by Aaron Hall <aaronch...@yahoo.com>: -- nosy: +Aaron Hall ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31333> ___ _

[issue12154] PyDoc Partial Functions

2017-09-02 Thread Aaron Hall
Aaron Hall added the comment: It seems that this issue is still properly open. (Another open issue seems be related: http://bugs.python.org/issue30129) In the docs on partial, we have: >>> from functools import partial >>> basetwo = partial(int, base=2) >>> basetw

[issue26103] Contradiction in definition of "data descriptor" between (dotted lookup behavior/datamodel documentation) and (inspect lib/descriptor how-to)

2017-06-07 Thread Aaron Hall
Aaron Hall added the comment: I tweaked the docs a little more this morning, but I believe I am done making any further changes unless so requested. This issue doesn't say it's assigned to anyone. Is there anything else that needs to happen here

[issue26103] Contradiction in definition of "data descriptor" between (dotted lookup behavior/datamodel documentation) and (inspect lib/descriptor how-to)

2017-06-06 Thread Aaron Hall
Aaron Hall added the comment: > Please also add yourself to Misc/ACKS. Done! -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.or

[issue26103] Contradiction in definition of "data descriptor" between (dotted lookup behavior/datamodel documentation) and (inspect lib/descriptor how-to)

2017-06-06 Thread Aaron Hall
Aaron Hall added the comment: Added news, working on tests -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26103> ___ ___ Pyth

[issue26103] Contradiction in definition of "data descriptor" between (dotted lookup behavior/datamodel documentation) and (inspect lib/descriptor how-to)

2017-06-05 Thread Aaron Hall
Changes by Aaron Hall <aaronch...@yahoo.com>: -- pull_requests: +2030 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26103> ___ _

[issue26103] Contradiction in definition of "data descriptor" between (dotted lookup behavior/datamodel documentation) and (inspect lib/descriptor how-to)

2017-06-05 Thread Aaron Hall
Aaron Hall added the comment: Bumping this - I intend to work on this next, if no objections. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue30463] Add __slots__ to ABC convenience class

2017-05-25 Thread Aaron Hall
Changes by Aaron Hall <aaronch...@yahoo.com>: -- pull_requests: +1908 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30463> ___ _

[issue30449] Improve __slots__ datamodel documentation

2017-05-25 Thread Aaron Hall
Aaron Hall added the comment: I created a new PR based on rhettinger's feedback (which on consideration was quite correct) with a fresh branch from master. Terseness is retained, and I think this revision makes the documentation more correct and complete. The rewording makes the behavior

[issue30449] Improve __slots__ datamodel documentation

2017-05-25 Thread Aaron Hall
Changes by Aaron Hall <aaronch...@yahoo.com>: -- pull_requests: +1905 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30449> ___ _

[issue30463] Add __slots__ to ABC convenience class

2017-05-24 Thread Aaron Hall
New submission from Aaron Hall: We have __slots__ with other ABC's, see http://bugs.python.org/issue11333 and http://bugs.python.org/issue21421. There are no downsides to having empty slots on a non-instantiable class, but it does give the option of denying __dict__ creation for subclassers

[issue30449] Improve __slots__ datamodel documentation

2017-05-23 Thread Aaron Hall
Aaron Hall added the comment: I've been working on this section quite a lot, trying to improve the flow of content (which in the prior revision is a bit of a mish-mash of information in the "Notes on using __slots__ section") - I intend to move some of that information into the

[issue30449] Improve __slots__ datamodel documentation

2017-05-23 Thread Aaron Hall
New submission from Aaron Hall: The __slots__ documentation in the datamodel needs improvement. For example: > When inheriting from a class without __slots__, the __dict__ attribute of > that class will always be accessible, so a __slots__ definition in the > subclass is me

[issue26103] Contradiction in definition of "data descriptor" between (dotted lookup behavior/datamodel documentation) and (inspect lib/descriptor how-to)

2016-01-13 Thread Aaron Hall
New submission from Aaron Hall: Based on the data-model documentation (https://docs.python.org/2/reference/datamodel.html#invoking-descriptors) and the dotted lookup behavior, the follow definitions are correct: "If the descriptor defines __set__() and/or __delete__(), it is a