[issue41232] Python `functools.wraps` doesn't deal with defaults correctly

2021-05-03 Thread Thor Whalen
Thor Whalen added the comment: On the surface, seems like a fair design to me: Back-compatible yet solves this misalignment that bugged me (literally). It would also force the documentation of `functools.wraps` to mention this "trap", through describing the `signature_cha

[issue41232] Python `functools.wraps` doesn't deal with defaults correctly

2020-08-05 Thread Thor Whalen
Thor Whalen added the comment: You are the guardians of the great python, so we can leave it at that if you want. That said for posterity, I'll offer a defense. The same "the tools does what it does, and if you need something else, use another tool" argument could have been appli

[issue41232] Python `functools.wraps` doesn't deal with defaults correctly

2020-08-04 Thread Thor Whalen
Thor Whalen added the comment: Hi Terry, sorry for the later reply. Is this a bugfix? Well, I'm not sure what you would call a bug. Can't one always redefine a bug to be a feature, and visa versa? I would definitely say that the behavior (seeing one default in the signature, but a different

[issue41232] Python `functools.wraps` doesn't deal with defaults correctly

2020-07-07 Thread Thor Whalen
Thor Whalen added the comment: Further, note that even with the additional '__defaults__', and '__kwdefaults__', `functools.wraps` breaks when keyword only arguments involved: ``` from functools import wraps, WRAPPER_ASSIGNMENTS, partial # First, I need to add `__defaults__

[issue41232] Python `functools.wraps` doesn't deal with defaults correctly

2020-07-07 Thread Thor Whalen
Thor Whalen added the comment: Posted to stackoverflow to gather opinions about the issue: https://stackoverflow.com/questions/62782230/python-functools-wraps-doesnt-deal-with-defaults-correctly Also made GitHub PR: https://github.com/python/cpython/pull/21379 -- keywords: +patch

[issue41232] Python `functools.wraps` doesn't deal with defaults correctly

2020-07-07 Thread Thor Whalen
New submission from Thor Whalen : # PROBLEM When using `functools.wraps`, the signature claims one set of defaults, but the (wrapped) function uses the original (wrappee) defaults. Why might that be the desirable default? # PROPOSED SOLUTION Adding '__defaults__', '__kwdefaults__

[issue40374] collections.abc docs table: Mapping missing __reversed__

2020-04-24 Thread Thor Whalen
Thor Whalen added the comment: Dennis, Thanks for the (very complete) explanation. I induced to err because of the following confusing facts: ``` from collections.abc import Mapping, Sequence import sys if sys.version_info <= (2, 7): assert '__reversed__' not in dir(Mapping) e

[issue40374] collections.abc docs table: Mapping missing __reversed__

2020-04-23 Thread Thor Whalen
New submission from Thor Whalen : `Mapping.__reversed__` exists, but is not listed in the table: https://docs.python.org/3/library/collections.abc.html#collections-abstract-base-classes https://github.com/python/cpython/blob/master/Doc/library/collections.abc.rst -- assignee: docs

Data peeping function?

2014-01-12 Thread Thor Whalen
The first thing I do once I import new data (as a pandas dataframe) is to .head() it, .describe() it, and then kick around a few specific stats according to what I see. But I'm not satisfied with .describe(). Amongst others, non-numerical columns are ignored, and off-the-shelf stats will be