[issue43682] Make function wrapped by staticmethod callable

2021-03-31 Thread STINNER Victor
STINNER Victor added the comment: > I don't understand what the problem is. _pyio.open is a function not a static > method. The problem is that _pyio.open doesn't behave exactly as io.open when it's used to define a method: --- #from io import open from _pyio import open class MyClass: m

[issue43682] Make function wrapped by staticmethod callable

2021-03-31 Thread Mark Shannon
Mark Shannon added the comment: I don't understand what the problem is. _pyio.open is a function not a static method. >>> import _pyio >>> _pyio.open -- nosy: +Mark.Shannon title: Make static methods created by @staticmethod callable -> Make function wrapped by staticmethod callabl

[issue43682] Make function wrapped by staticmethod callable

2021-03-31 Thread STINNER Victor
STINNER Victor added the comment: > Seems like a duplicate of #20309. My usecase is to avoid any behavior difference between io.open and _pyio.open functions: PEP 399 "Pure Python/C Accelerator Module Compatibility Requirements". Currently, this is a very subtle difference when it's used to

[issue43682] Make function wrapped by staticmethod callable

2021-03-31 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +23860 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25117 ___ Python tracker ___ _

[issue43682] Make function wrapped by staticmethod callable

2021-03-31 Thread Mark Dickinson
Mark Dickinson added the comment: Seems like a duplicate of #20309. -- nosy: +mark.dickinson ___ Python tracker ___ ___ Python-bugs

[issue43682] Make function wrapped by staticmethod callable

2021-03-31 Thread STINNER Victor
New submission from STINNER Victor : Currently, static methods created by the @staticmethod decorator are not callable as regular function. Example: --- @staticmethod def func(): print("my func") class MyClass: method = func func() # A: regular function MyClass.method() # B: class met