[issue45356] Calling `help` executes @classmethod @property decorated methods

2022-02-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: See also: https://bugs.python.org/issue46764 -- ___ Python tracker ___ ___ Python-bugs-list

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-12-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: In Python 3.10, classmethod() added a __wrapped__ attribute. Presumably, any use case for implicit chaining can now be accomplished in an explicit and controlled manner. -- ___ Python tracker

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-12-01 Thread Stephen Rosen
Stephen Rosen added the comment: Probably >90% of the use-cases for chaining classmethod are a read-only class property. It's important enough that some tools (e.g. sphinx) even have special-cased support for classmethod(property(...)). Perhaps the general case of

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-11-19 Thread Alex Waygood
Alex Waygood added the comment: It makes me sad that the stdlib will no longer provide a way to compose classmethods with other descriptors. However, I agree that deprecating classmethod chaining is probably the correct course of action, given the complications this feature has caused, and

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-11-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: I propose deprecating classmethod chaining. It has become clear that it doesn't really do what people wanted and can't easily be made to work. By even suggesting that some stateful decorators are composable, we've ventured onto thin ice. Wrapping

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-11-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: Also see: https://bugs.python.org/issue42073 The classmethod pass through broke some existing code and the "fix" for it looks dubious: if hasattr(type(self.f), '__get__'): return self.f.__get__(cls, cls) --

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-27 Thread Graham Dumpleton
Graham Dumpleton added the comment: Too much to grok right now. There is already a convention for what a decorator wraps. It is __wrapped__. https://github.com/python/cpython/blob/3405792b024e9c6b70c0d2355c55a23ac84e1e67/Lib/functools.py#L70 Don't use __func__ as that has other defined

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-27 Thread wim glenn
wim glenn added the comment: added Graham Dumpleton to nosy list in case he has some useful insight here, I think the PR from issue19072 may have been adapted from grahamd's patch originally? -- nosy: +grahamd ___ Python tracker

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-27 Thread Andrei Kulakov
Andrei Kulakov added the comment: I've looked more into it, the issue is that even before an object can be tested with `isinstance()`, both inspect.classify_class_attrs and in pydoc, classdoc local function `spill()` use a `getattr()` call, which triggers the property. So I think my PR is

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-27 Thread Andrei Kulakov
Andrei Kulakov added the comment: I missed that this is assigned to Raymond, hope we didn't duplicate any effort (it only took me a short while to do the PR). Apologies.. -- ___ Python tracker

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-27 Thread Andrei Kulakov
Andrei Kulakov added the comment: I've put up a PR; I'm not sure it's the best way to fix it. I will look more into it and will try to post some details about the PR later today. -- ___ Python tracker

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-27 Thread Andrei Kulakov
Change by Andrei Kulakov : -- keywords: +patch nosy: +andrei.avk nosy_count: 8.0 -> 9.0 pull_requests: +27502 stage: test needed -> patch review pull_request: https://github.com/python/cpython/pull/29239 ___ Python tracker

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-12 Thread Randolf Scholz
Randolf Scholz added the comment: @Alex Regarding my proposal, the crucial part is the desiderata, not the hacked up implementation I presented. And I really believe that at least that part I got hopefully right. After all, what does `@classmethod` functionally do? It makes the first

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-11 Thread Alex Waygood
Alex Waygood added the comment: Some thoughts from me, as an unqualified but interested party: Like Randolph, I very much like having class properties in the language, and have used them in several projects since their introduction in 3.9. I find they're especially useful with Enums.

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-11 Thread Randolf Scholz
Randolf Scholz added the comment: Dear Raymond, I think decorator chaining is a very useful concept. At the very least, if all decorators are functional (following the `functools.wraps` recipe), things work out great -- we even get associativity of function composition if things are done

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-10 Thread Raymond Hettinger
Raymond Hettinger added the comment: It may have been a mistake to allow this kind of decorator chaining. * As Randolf and Alex have noticed, it invalidates assumptions made elsewhere in the standard library and presumably in third-party code as well. * And as Randolf noted in his last

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-10 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'm merging issue 44904 into this one because they are related. -- nosy: +rhettinger ___ Python tracker ___

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-10 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-10 Thread Randolf Scholz
Randolf Scholz added the comment: If fact, in the current state it seem that it is impossible to implement real class-properties, for a simple reason: descriptor.__set__ is only called when setting the attribute of an instance, but not of a class!! ```python import math class

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-10 Thread Randolf Scholz
Randolf Scholz added the comment: @Terry I think the problem boils down to the fact that `@classmethod @property` decorated methods end up not being real properties. Calling `MyBaseClass.__dict__` reveals: ```python mappingproxy({'__module__': '__main__',

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-08 Thread Terry J. Reedy
Terry J. Reedy added the comment: On current 3.9, 3.10, 3.11, on Windows running in IDLE, I see computing class property .. computing class property .. computing class property .. computing class property .. computing class property .. Help ... -- versions: +Python 3.11 -Python 3.10,

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-08 Thread Terry J. Reedy
Terry J. Reedy added the comment: Randolf, what specific behaviors do you consider to be bugs that should be fixed. What would a test of the the changed behavior look like? This should perhaps be closed as a duplicate of #44904. Randolf, please check and say what you thing. --

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-04 Thread wim glenn
Change by wim glenn : -- nosy: +wim.glenn ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-04 Thread Dong-hee Na
Change by Dong-hee Na : -- nosy: +corona10 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-03 Thread Alex Waygood
Alex Waygood added the comment: See also: https://bugs.python.org/issue44904 -- nosy: +AlexWaygood ___ Python tracker ___ ___

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-03 Thread Randolf Scholz
Randolf Scholz added the comment: I updated the script with dome more info. The class-property gets actually executed 5 times when calling `help(MyClass)` ``` Computing class property of ...DONE! Computing class property of ...DONE! Computing class property of ...DONE! Computing class

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-03 Thread Randolf Scholz
New submission from Randolf Scholz : I noticed some strange behaviour when calling `help` on a class inheriting from a class or having itself @classmethod @property decorated methods. ```python from time import sleep from abc import ABC, ABCMeta, abstractmethod class MyMetaClass(ABCMeta):