[issue47030] singledispatch does not work with positional arguments with default values.

2022-03-15 Thread Randolf Scholz
New submission from Randolf Scholz : from functools import singledispatch from typing import Optional @singledispatch def load(key: Optional[str] = None, /) -> None: raise NotImplementedError @load.register def _(key: None, /) -> None: print(f"loaded {key=}") @l

[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 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 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 TrigConst

[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__':

[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