[pypy-dev] Allow subclassing `staticmethod` and `classmethod`

cool-RR cool-rr at cool-rr.com
Tue May 3 13:38:11 CEST 2011


Cool. Is there gonna be a 1.5.1 release with stuff like this?

On Tue, May 3, 2011 at 1:36 PM, Carl Friedrich Bolz <cfbolz at gmx.de> wrote:

> Hi Ram,
>
> On 05/03/2011 01:25 PM, cool-RR wrote:
> > In my project I made an `abstract_static_method` class:
> >
> >
> https://github.com/cool-RR/GarlicSim/blob/master/garlicsim/garlicsim/general_misc/abc_tools.py#L7
> >
> > <
> https://github.com/cool-RR/GarlicSim/blob/master/garlicsim/garlicsim/general_misc/abc_tools.py#L7
> >A
> > similar one has been made in Python 3.2:
> >
> > http://hg.python.org/cpython/file/default/Lib/abc.py#l48
> >
> >
> > <http://hg.python.org/cpython/file/default/Lib/abc.py#l48>In Pypy this
> > currently cannot be done, because if you subclass `staticmethod` into
> > `abstractstaticmethod`, any instances will have a class
> > of `staticmethod` instead of `abstractstaticmethod`:
> >
> >      >>>> class A(staticmethod):
> >     ....   pass
> >     ....
> >      >>>> def f():
> >     ....   pass
> >     ....
> >      >>>> a = A(f)
> >      >>>> a
> >     <staticmethod object at 0x00f2ade0>
> >      >>>> type(a)
> >     <type 'staticmethod'>
> >
> >
> > What can be done? I want to have `abstract_static_method` in my code.
>
>
> This is a bug in PyPy, I fixed it in the repo, tomorrow you can use a
> fresh nightly build from here:
>
> http://buildbot.pypy.org/nightly/trunk/
>
> Carl Friedrich
> _______________________________________________
> pypy-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/pypy-dev
>



-- 
Sincerely,
Ram Rachum
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20110503/b8e8c44f/attachment.html>


More information about the pypy-dev mailing list