On Thu, Apr 1, 2021 at 11:52 AM Brett Cannon wrote:
>
> On Wed., Mar. 31, 2021, 18:56 Inada Naoki, wrote:
>>
>> Do we need _pyio at all?
>> Does PyPy or any other Python implementation use it?
>
> https://www.python.org/dev/peps/pep-0399/ would suggest rolling back Python
> support is something
On Wed., Mar. 31, 2021, 18:56 Inada Naoki, wrote:
> Do we need _pyio at all?
> Does PyPy or any other Python implementation use it?
>
https://www.python.org/dev/peps/pep-0399/ would suggest rolling back Python
support is something to avoid.
> On Wed, Mar 31, 2021 at 9:36 PM Victor Stinner
> w
Do we need _pyio at all?
Does PyPy or any other Python implementation use it?
On Wed, Mar 31, 2021 at 9:36 PM Victor Stinner wrote:
>
> Hi,
>
> The io module provides an open() function. It also provides an
> OpenWrapper which only exists to be able to store open as a method
> (class or instance
> On 31 Mar 2021, at 13:34, Victor Stinner wrote:
>
> def func():
>print("my func")
This would work for the example given of a func with no args.
But cannot check it called with the right number.
def func(*args):
print("my func")
A signature like this would be a hard nut to crack.
d
Honestly it has always bugged me that staticmethod only becomes callable
through __get__. So I think this would be fine. But I don't know if there
might be unintended consequences.
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send a
I created https://bugs.python.org/issue43682 "Make static methods
created by @staticmethod callable".
Oh, I didn't know this old bpo-20309 issue closed as "not a bug". But
it proposed to modify many other wrappers like @classmethod. I only
propose to make static methods created @staticmethod calla
On 3/31/21 6:49 AM, Victor Stinner wrote:
tl; dr *Maybe* staticmethod could be modified to become callable?
There have been other requests to make staticmethod callable, one of them being
https://bugs.python.org/issue20309
+1 for having it done.
--
~Ethan~
A friend, Antoine Rozo, wrote a variant of staticmethod which is
callable. With this decorator, it works in A, B and C cases:
---
class simplefunction:
def __init__(self, func):
self.func = func
def __get__(self, owner, instance):
return self.func
def __call__(self, *arg
tl; dr *Maybe* staticmethod could be modified to become callable?
io.open is a built-in function (type "builtin_function_or_method"). It
behaves differently than _pyio.open which is a Python function (type
"function").
The difference is in the LOAD_METHOD bytecode which uses __get__()
descriptor