[issue40278] pathlib Path.replace raises OSError when target exists

2020-04-13 Thread Michael Selik
Michael Selik added the comment: The docs for ``os.replace`` says "If dst is a directory, OSError will be raised." That's helpful, but the docs for ``pathlib.Path.replace`` make it seem like the target will be unconditionally replaced regardless of whether it's a file or direct

[issue40278] pathlib Path.replace raises OSError when target exists

2020-04-13 Thread Michael Selik
New submission from Michael Selik : The pathlib module ``Path.replace(target)`` states that "If target points to an existing file or directory, it will be unconditionally replaced." However, this does not appear to be true. I experience an OSError ``[Errno 66] Directory not em

[issue34498] Python 3.7 breaks on singledispatch_function.register(pseudo_type), which Python 3.6 accepted

2019-03-28 Thread Michael Selik
Michael Selik added the comment: +1 for this use case. Until it's resolved, perhaps there should be a note in the singledispatch docs that types from the ``typing`` module should not be used? -- nosy: +selik ___ Python tracker <ht

[issue36018] Add a Normal Distribution class to the statistics module

2019-02-19 Thread Michael Selik
Michael Selik added the comment: +1, This would be useful for quick analyses, avoiding the overhead of installing scipy and looking through its documentation. Given that it's in the statistics namespace, I think the name can be simply ``Normal`` rather than ``NormalDist``. Also, instead

[issue34003] csv.DictReader can return basic dict instead of OrderedDict

2018-06-29 Thread Michael Selik
Michael Selik added the comment: I searched for previously submitted issues, but somehow didn't spot #32339. I'll do some searching for whether anyone uses ``move_to_end`` on DictReader rows and respond to the mailing list with a report

[issue34003] csv.DictReader can return basic dict instead of OrderedDict

2018-06-29 Thread Michael Selik
Change by Michael Selik : -- components: +Library (Lib) ___ Python tracker <https://bugs.python.org/issue34003> ___ ___ Python-bugs-list mailing list Unsub

[issue34003] csv.DictReader can return basic dict instead of OrderedDict

2018-06-29 Thread Michael Selik
Change by Michael Selik : -- type: -> performance ___ Python tracker <https://bugs.python.org/issue34003> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue34003] csv.DictReader can return basic dict instead of OrderedDict

2018-06-29 Thread Michael Selik
Michael Selik added the comment: Pull request. https://github.com/python/cpython/pull/8014 -- ___ Python tracker <https://bugs.python.org/issue34003> ___ ___

[issue34003] csv.DictReader can return basic dict instead of OrderedDict

2018-06-29 Thread Michael Selik
Change by Michael Selik : -- keywords: +patch pull_requests: +7622 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34003> ___ ___ Py

[issue34003] csv.DictReader can return basic dict instead of OrderedDict

2018-06-29 Thread Michael Selik
New submission from Michael Selik : Since dicts are now keeping insertion order as of 3.7, we can switch to the more efficient construction of dict rather than OrderedDict for each row in the CSV file. -- messages: 320734 nosy: selik priority: normal severity: normal status: open

[issue34002] minor efficiency and clarity improvements in email package

2018-06-29 Thread Michael Selik
Change by Michael Selik : -- components: +email nosy: +barry, r.david.murray versions: +Python 3.8 ___ Python tracker <https://bugs.python.org/issue34

[issue34002] minor efficiency and clarity improvements in email package

2018-06-29 Thread Michael Selik
Change by Michael Selik : -- keywords: +patch pull_requests: +7620 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34002> ___ ___ Py

[issue34002] minor efficiency and clarity improvements in email package

2018-06-29 Thread Michael Selik
New submission from Michael Selik : The primary motivation for these improvements was avoiding a while/pop pattern for looping. A for-loop is a big improvement over copying a list, then repeatedly popping the 0th element. A lesser improvement is the use of ``a.intersection(b)`` instead

[issue33462] reversible dict

2018-06-08 Thread Michael Selik
Michael Selik added the comment: It looks like there's general agreement on python-dev that this is appropriate for v3.8 (not v3.7). Guido van Rossum and Ramsey D'silva gave a +1. Raymond Hettinger noted some use cases. INADA Naoki raised a point about waiting for other implementations

[issue33463] Can namedtuple._asdict return a regular dict instead of OrderedDict?

2018-05-23 Thread Michael Selik
Michael Selik <m...@selik.org> added the comment: I changed the PR to simply replace OrderedDict with dict. For the docs warnings, if I'm understanding correctly, those should be separate pulls for older branches? -- ___ Python tracke

[issue33462] reversible dict

2018-05-12 Thread Michael Selik
Michael Selik <m...@selik.org> added the comment: Right, a blend of the code from dictiterobject (https://github.com/python/cpython/blob/master/Objects/dictobject.c#L3309) and listreviterobject (https://github.com/python/cpython/blob/master/Objects/listobject.c

[issue33463] Can namedtuple._asdict return a regular dict instead of OrderedDict?

2018-05-12 Thread Michael Selik
Change by Michael Selik <m...@selik.org>: -- keywords: +patch pull_requests: +6461 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue33463] Can namedtuple._asdict return a regular dict instead of OrderedDict?

2018-05-12 Thread Michael Selik
Michael Selik <m...@selik.org> added the comment: Is this warning what you had in mind? https://github.com/python/cpython/pull/6772 -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue33463] Can namedtuple._asdict return a regular dict instead of OrderedDict?

2018-05-10 Thread Michael Selik
New submission from Michael Selik <m...@selik.org>: Since the basic dict is now keeping insertion order, can we switch namedtuple._asdict to return a basic dict? Other than OrderedDict.move_to_end and the repr, I believe there is no compatibility issue. -- messages: 316387 nosy:

[issue33462] reversible dict

2018-05-10 Thread Michael Selik
New submission from Michael Selik <m...@selik.org>: Now that dicts are tracking insertion order, they can be made reversible via the built-in reversed, just like OrderedDict. -- messages: 316386 nosy: selik priority: normal severity: normal status: open title: reversible dic

[issue33203] random.choice: raise IndexError on empty sequence even when not using getrandbits internally

2018-04-02 Thread Michael Selik
Michael Selik <m...@selik.org> added the comment: If you're going to tackle this problem, this should probably be solved for the general case of n <= 0 rather than just n == 0. In [1]: import random In [2]: class Random(random.Random): ...: def random(self): ...:

[issue31908] trace module cli does not write cover files

2017-11-13 Thread Michael Selik
Michael Selik <m...@selik.org> added the comment: You're referring to something like this: +def test_count_and_summary(self): +name = TESTFN + '.py' +with open(name, 'w') as fd: +self.addCleanup(unlink, name) +fd.write("""\ +

[issue31908] trace module cli does not write cover files

2017-11-13 Thread Michael Selik
Change by Michael Selik <m...@selik.org>: -- nosy: +selik ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31908> ___ __

[issue31915] (list).insert() not working

2017-10-31 Thread Michael Selik
New submission from Michael Selik <michael.se...@gmail.com>: What behavior did you expect from your code? What behavior did you get instead? It looks like you're not calling the list copy method correctly. Try writing "tables2.copy()" instead of "tables2.copy". I

[issue31908] trace module cli does not write cover files

2017-10-31 Thread Michael Selik
Michael Selik <michael.se...@gmail.com> added the comment: Ok, pull request submitted: https://github.com/python/cpython/pull/4205 -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue31908] trace module cli does not write cover files

2017-10-31 Thread Michael Selik
Change by Michael Selik <m...@selik.org>: -- keywords: +patch pull_requests: +4174 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue31908] trace module cli does not write cover files

2017-10-31 Thread Michael Selik
Michael Selik <michael.se...@gmail.com> added the comment: While writing a patch for this, I noticed the ``lnotab`` parameter seems nearly unused. It's a dict, but is only used for its keys. https://github.com/python/cpython/blob/master/Lib/trace.py#L333 Further, the choice to count unr

[issue31908] trace module cli does not write cover files

2017-10-31 Thread Michael Selik
Michael Selik <michael.se...@gmail.com> added the comment: The problem appears to be a mistake in commit f026dae130bf6f9015c4b212f16852ba4a3f3dec https://github.com/python/cpython/commit/f026dae130bf6f9015c4b212f16852ba4a3f3dec This made the writing of cover files condi

[issue31908] trace module cli does not write cover files

2017-10-30 Thread Michael Selik
New submission from Michael Selik <michael.se...@gmail.com>: The trace module command-line utility doesn't write cover files. I've noticed this issue for some years now. It works fine in Python 2. When using Python 3, no ".cover" files are written, regardless of how "--c

[issue29965] MatchObject __getitem__() should support slicing and len

2017-04-03 Thread Michael Selik
Michael Selik added the comment: Sorry, it looks like I got the issue number wrong. My comparison should not have been with #24454, but instead with an issue I can't locate at the moment. Reproducing the example: for g0, g1, g2 in re.finditer(r'(\d+)/(\d+)', 'Is 1/3 the same as 2/6

[issue29965] MatchObject __getitem__() should support slicing and len

2017-04-03 Thread Michael Selik
Michael Selik added the comment: Yesterday I wanted to do a destructuring bind on a slice of groups in a finditer. Similar situation to the use case of Issue #24454. It might not be "normal code" but I end up in that situation every month or so when parsing semi-structured document

[issue29965] MatchObject __getitem__() should support slicing and len

2017-04-02 Thread Michael Selik
Michael Selik added the comment: This would also enable negative indexing, which currently raises "IndexError: no such group". Edit: I meant whole numbers, not natural numbers. -- versions: +Python 3.7 ___ Python tracker <rep...@bu

[issue29965] MatchObject __getitem__() should support slicing and len

2017-04-02 Thread Michael Selik
Changes by Michael Selik <m...@selik.org>: -- components: +Regular Expressions nosy: +ezio.melotti, mrabarnett type: -> enhancement ___ Python tracker <rep...@bugs.python.org> <http://bugs.pyt

[issue29965] MatchObject __getitem__() should support slicing and len

2017-04-02 Thread Michael Selik
New submission from Michael Selik: Currently, slicing a MatchObject causes an IndexError and len() a TypeError. It's natural to expect slicing and len to work on objects of a finite length that index by natural numbers. -- messages: 291050 nosy: selik priority: normal severity: normal

[issue29957] unnecessary LBYL for key contained in defaultdict, lib2to3/btm_matcher

2017-04-01 Thread Michael Selik
Michael Selik added the comment: Ok, I'll change the PR. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29957> ___ ___ Pyth

[issue29957] unnecessary LBYL for key contained in defaultdict, lib2to3/btm_matcher

2017-03-31 Thread Michael Selik
Michael Selik added the comment: PR submitted. I also signed the contributor agreement, but the bot doesn't seem to have noticed. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue29957] unnecessary LBYL for key contained in defaultdict, lib2to3/btm_matcher

2017-03-31 Thread Michael Selik
Michael Selik added the comment: I'll submit a pull request momentarily. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29957> ___ __

[issue29957] unnecessary LBYL for key contained in defaultdict, lib2to3/btm_matcher

2017-03-31 Thread Michael Selik
New submission from Michael Selik: Minor, but it looks like someone decided to use a defaultdict but forgot to remove the checks for whether a key exists. Creating a defaultdict(list): https://github.com/python/cpython/blob/6f0eb93183519024cb360162bdd81b9faec97ba6/Lib/lib2to3/btm_matcher.py

[issue23883] __all__ lists are incomplete

2015-11-04 Thread Michael Selik
Michael Selik added the comment: many things are not present in os.__all__ that should be, including os.getcwd -- nosy: +selik ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i