[issue40563] Support pathlike objects on dbm/shelve

2021-09-08 Thread David Mertz
David Mertz added the comment: If anyone wants to look at my not-yet-complete changes (see other comment), it's https://github.com/DavidMertz/cpython/tree/bpo-45133. It has a different bpo because I filed a duplicate before realizing. I can change the branch name before a PR, but making

[issue40563] Support pathlike objects on dbm/shelve

2021-09-08 Thread David Mertz
David Mertz added the comment: I've made the few additional changes to those in this PR. When I work out the issues, I'll make a new PR. I took out an attempt with `path_t`. However, here is why I think argument clinic (or something else?!) is actually intercepting the attempted call

[issue45133] Open functions in dbm submodule should support path-like objects

2021-09-07 Thread David Mertz
David Mertz added the comment: Oops... I missed prior closely related or identical issue at: https://bugs.python.org/issue40563 -- resolution: -> duplicate ___ Python tracker <https://bugs.python.org/issu

[issue45133] Open functions in dbm submodule should support path-like objects

2021-09-07 Thread David Mertz
New submission from David Mertz : Evan Greenup via Python-ideas Currently, in Python 3.9, `dbm.open()`, `dbm.gnu.open()` and `dbm.ndbm.open()` doesn't support path-like object, class defined in `pathlib`. It would be nice to add support with it. -- components: Library (Lib

[issue33084] Computing median, median_high an median_low in statistics library

2019-01-06 Thread David Mertz
David Mertz added the comment: I believe that the current behavior of `statistics.median[|_low|_high\]` is simply broken. It relies on the particular behavior of Python sorting, which only utilizes `.__lt__()` between objects, and hence does not require a total order. I can think

[issue25478] Consider adding a normalize() method to collections.Counter()

2017-03-14 Thread David Mertz
David Mertz added the comment: Raymond wrote: > The idea is that the method would return a new counter instance > and leave the existing instance untouched. Your own first example suggested: c /= sum(c.values()) That would suggest an inplace modification. But even i

[issue25478] Consider adding a normalize() method to collections.Counter()

2017-03-14 Thread David Mertz
David Mertz added the comment: I definitely wouldn't want a mutator that "normalized" counts for the reason Antoine mentions. It would be a common error to normalize then continue meaningless counting. One could write a `Frequency` subclass easily enough. The essential feature i