Daniel Urban urban.dani...@gmail.com added the comment:
I'm attaching a new patch containing also some documentation for the two new
decorators. The doc is rather terse, and english is not my first language, so
please let me know if some corrections are needed.
--
Added file:
Éric Araujo mer...@netwok.org added the comment:
Looks good.
--
nosy: +eric.araujo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5867
___
___
Benjamin Peterson benja...@python.org added the comment:
Applied in r84124. Thanks for the patch.
--
resolution: - accepted
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5867
Antoine Pitrou pit...@free.fr added the comment:
The patch looks fine code-wise, but it also needs a doc addition in
Doc/library/abc.rst.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5867
Daniel Urban urban.dani...@gmail.com added the comment:
I'm attaching a new patch adding the abc.abstractclassmethod and
abc.abstractstaticmethod decorators.
--
Added file: http://bugs.python.org/file18519/abstractclassstaticmethod.diff
___
Python
Daniel Urban urban.dani...@gmail.com added the comment:
@abstractmethod
@classmethod
def ...
doesn't work because classmethod objects doesn't have a __dict__, so setting
arbitrary attributes don't work, and abstractmethod tries to set the
__isabstractmethod__ atribute to True.
The other
Daniel Urban urban.dani...@gmail.com added the comment:
Here is a patch, which adds a descriptor to classmethod and staticmethod.
Pseudocode:
__get__(self, inst, owner):
if getattr(inst.callable, '__isabstractmethod__', False):
return True
return False
__set__(self, inst,
Antoine Pitrou pit...@free.fr added the comment:
The patch doesn't check that instantiating these methods work at all.
--
nosy: +benjamin.peterson, pitrou
stage: - patch review
versions: +Python 3.2 -Python 3.1
___
Python tracker
Daniel Urban urban.dani...@gmail.com added the comment:
If I understand correctly, some tests are needed for the instantiation of
classes with abstract static/classmethods. I added them in issue5867a.diff.
--
Added file: http://bugs.python.org/file18512/issue5867a.diff
Antoine Pitrou pit...@free.fr added the comment:
Thank you. I'm not an ABC expert but it looks ok. Guido, what do you think?
--
nosy: +gvanrossum
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5867
Guido van Rossum gu...@python.org added the comment:
As you figured out it is not yet supported.
I object to making changes to the classmethod implementation.
I expect the best thing to do is to add a new
@abc.abstractclassmethod
decorator defined in pure Python (maybe the definition of
Changes by Daniel Urban urban.dani...@gmail.com:
--
nosy: +durban
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5867
___
___
Python-bugs-list
Terry J. Reedy tjre...@udel.edu added the comment:
Please ask questions like this first on python-list or the c.l.p or
gmane mirrors.
--
nosy: +tjreedy
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5867
New submission from Matteo Dell'Amico de...@linux.it:
Is there a way to define an abstract classmethod? The two obvious ways
don't seem to work properly.
Python 3.0.1+ (r301:69556, Apr 15 2009, 17:25:52)
[GCC 4.3.3] on linux2
Type help, copyright, credits or license for more information.
Changes by Benjamin Peterson benja...@python.org:
--
priority: - normal
type: behavior - feature request
versions: +Python 3.1 -Python 3.0
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5867
15 matches
Mail list logo