[issue11610] Improved support for abstract base classes with descriptors

2011-12-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset e979b26a9172 by Benjamin Peterson in branch 'default': improve abstract property support (closes #11610) http://hg.python.org/cpython/rev/e979b26a9172 -- nosy: +python-dev resolution: -> fixed stage: -> committed/rejected status: open ->

[issue11610] Improved support for abstract base classes with descriptors

2011-12-15 Thread Darren Dale
Darren Dale added the comment: Is this patch ready to go? I haven't heard any feedback on the most recent version. -- ___ Python tracker ___ ___

[issue11610] Improved support for abstract base classes with descriptors

2011-12-07 Thread Darren Dale
Darren Dale added the comment: New patch addressing comments in review. -- Added file: http://bugs.python.org/file23864/abc_descriptor.patch ___ Python tracker ___ _

[issue11610] Improved support for abstract base classes with descriptors

2011-12-06 Thread Nick Coghlan
Nick Coghlan added the comment: Added some review comments in Reitveld - core functionality changes look good, but there are some other aspects that need addressing before the patch will be good to go (primarily relating to only doing a minimal documented deprecation of the legacy APIs withou

[issue11610] Improved support for abstract base classes with descriptors

2011-12-05 Thread Nick Coghlan
Changes by Nick Coghlan : Removed file: http://bugs.python.org/file22407/abc_descriptor.patch ___ Python tracker ___ ___ Python-bugs-list mail

[issue11610] Improved support for abstract base classes with descriptors

2011-12-05 Thread Nick Coghlan
Changes by Nick Coghlan : Removed file: http://bugs.python.org/file22729/abc_descriptor.patch ___ Python tracker ___ ___ Python-bugs-list mail

[issue11610] Improved support for abstract base classes with descriptors

2011-12-05 Thread Nick Coghlan
Changes by Nick Coghlan : Removed file: http://bugs.python.org/file23819/abc_descriptor.patch ___ Python tracker ___ ___ Python-bugs-list mail

[issue11610] Improved support for abstract base classes with descriptors

2011-12-05 Thread Darren Dale
Darren Dale added the comment: Patch addressing latest comments in review. Notable change: defines _PyObject_IsAbstract in object.c/object.h, rather than repeating the code in multiple files and functions. -- Added file: http://bugs.python.org/file23857/abc_descriptor.patch _

[issue11610] Improved support for abstract base classes with descriptors

2011-11-30 Thread Darren Dale
Darren Dale added the comment: Here is a new patch addressing comments raised in review. It supersedes previous patch submissions. -- Added file: http://bugs.python.org/file23819/abc_descriptor.patch ___ Python tracker

[issue11610] Improved support for abstract base classes with descriptors

2011-11-27 Thread Darren Dale
Darren Dale added the comment: I'll bump this one last time. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue11610] Improved support for abstract base classes with descriptors

2011-11-07 Thread Éric Araujo
Changes by Éric Araujo : ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-b

[issue11610] Improved support for abstract base classes with descriptors

2011-11-07 Thread Darren Dale
Darren Dale added the comment: I just double-checked that the unit tests do not raise any warnings with this patch. Can it be merged? -- ___ Python tracker ___ ___

[issue11610] Improved support for abstract base classes with descriptors

2011-10-17 Thread Éric Araujo
Éric Araujo added the comment: I noticed this in an older message: > test_abc.py prints deprecation warnings for abstractproperty. I'm not > familiar with the protocol here, do we continue to include unit tests > for deprecated features until they are removed? We try to keep the test warning-fr

[issue11610] Improved support for abstract base classes with descriptors

2011-10-16 Thread Darren Dale
Darren Dale added the comment: It would be nice if this patch could be merged in time for python-3.3... -- ___ Python tracker ___ ___

[issue11610] Improved support for abstract base classes with descriptors

2011-09-15 Thread Darren Dale
Darren Dale added the comment: Any additional comments? -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue11610] Improved support for abstract base classes with descriptors

2011-07-23 Thread Michael Foord
Changes by Michael Foord : -- nosy: -michael.foord ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail

[issue11610] Improved support for abstract base classes with descriptors

2011-07-23 Thread Darren Dale
Darren Dale added the comment: Here is a new version of the patch, addressing points raised in the review of the previous version. -- Added file: http://bugs.python.org/file22729/abc_descriptor.patch ___ Python tracker

[issue11610] Improved support for abstract base classes with descriptors

2011-07-22 Thread Darren Dale
Darren Dale added the comment: I've requested additional feedback based on comments at Rietveld. -- ___ Python tracker ___ ___ Python

[issue11610] Improved support for abstract base classes with descriptors

2011-06-20 Thread Daniel Urban
Daniel Urban added the comment: I've posted some comments on Rietveld. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Un

[issue11610] Improved support for abstract base classes with descriptors

2011-06-19 Thread Darren Dale
Changes by Darren Dale : Removed file: http://bugs.python.org/file22323/abc_descriptors.patch ___ Python tracker ___ ___ Python-bugs-list mail

[issue11610] Improved support for abstract base classes with descriptors

2011-06-19 Thread Darren Dale
Changes by Darren Dale : Removed file: http://bugs.python.org/file21375/issue11610_v2.patch ___ Python tracker ___ ___ Python-bugs-list mailin

[issue11610] Improved support for abstract base classes with descriptors

2011-06-19 Thread Darren Dale
Changes by Darren Dale : Removed file: http://bugs.python.org/file21307/issue11610.patch ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue11610] Improved support for abstract base classes with descriptors

2011-06-19 Thread Darren Dale
Darren Dale added the comment: Here is attempt #4. This patch extends the property, classmethod and staticmethod builtins with an __isabstractmethod__ descriptor. Docs and tests are updated as well. "make test" runs without failures. This is my first real attempt with the C-API, and I think I

[issue11610] Improved support for abstract base classes with descriptors

2011-06-12 Thread Nick Coghlan
Nick Coghlan added the comment: Non-conformant explicit registration is permitted on purpose to allow developers to only supply partial implementations when it is known that that is all a given application requires. Extremely impure, but quite practical :) Note that the core logic of inspect.

[issue11610] Improved support for abstract base classes with descriptors

2011-06-12 Thread Darren Dale
Darren Dale added the comment: On Sat, Jun 11, 2011 at 7:32 PM, Eric Snow wrote: > > Eric Snow added the comment: > Per your last message, if a specific descriptor has an abstract setter then > the descriptor should be considered abstract.  If the implementation of that > attribute is not a

[issue11610] Improved support for abstract base classes with descriptors

2011-06-12 Thread Nick Coghlan
Nick Coghlan added the comment: In that paragraph, I was only talking about cases where "foo = 1" *isn't* a valid override (which, I hope you'll agree, it typically won't be). Your described approach of declaring an abstract property and then overriding it with an ordinary class attribute is

[issue11610] Improved support for abstract base classes with descriptors

2011-06-12 Thread Éric Araujo
Éric Araujo added the comment: > there's nothing an ABC can do to stop someone (for example) overriding > an abstract method or descriptor "foo" with "foo = 1". I’ve find it useful to use an abstractproperty to specify an attribute that concrete subclasses have to define. Was that wrong? Fro

[issue11610] Improved support for abstract base classes with descriptors

2011-06-11 Thread Eric Snow
Eric Snow added the comment: Didn't mean to sidetrack. :) I really appreciate the effort Darren has put into this. -- ___ Python tracker ___ _

[issue11610] Improved support for abstract base classes with descriptors

2011-06-11 Thread Nick Coghlan
Nick Coghlan added the comment: Remember the goal here is *not* to completely eliminate the need to test that objects implement an ABC correctly. It's to make it easier to declare the expected interface in a way that helps readers of the ABC definition to figure out what is going on, and to r

[issue11610] Improved support for abstract base classes with descriptors

2011-06-11 Thread Eric Snow
Eric Snow added the comment: Perhaps rather than changing ABCMeta, provide a base descriptor class that has __isabstractmethod__ implemented to calculate the abstractness. Then property could use that, as could any of the other relevant descriptors we have around. The __isabstractmethod__ a

[issue11610] Improved support for abstract base classes with descriptors

2011-06-11 Thread Darren Dale
Darren Dale added the comment: [...] > > This wouldn't allow for the prettier error messages, but it's much cleaner > than having ABCMeta trawling through class attribute dir() lists. I think there is another reason to do it this way. Suppose I have a custom descriptor MyProperty that stores i

[issue11610] Improved support for abstract base classes with descriptors

2011-06-11 Thread Darren Dale
Darren Dale added the comment: On Sat, Jun 11, 2011 at 8:55 AM, Nick Coghlan wrote: > > Nick Coghlan added the comment: > > inspect.getattr_static has the necessary logic to search for descriptors > without invoking them. Unfortunately, we can't import inspect, even inside ABCMeta.__new__.

[issue11610] Improved support for abstract base classes with descriptors

2011-06-11 Thread Nick Coghlan
Nick Coghlan added the comment: inspect.getattr_static has the necessary logic to search for descriptors without invoking them. However, it may be better to revert to the idea of pushing this functionality back onto the individual descriptors and have the problematic descriptors like propert

[issue11610] Improved support for abstract base classes with descriptors

2011-06-11 Thread Darren Dale
Darren Dale added the comment: [...] >> Traceback (most recent call last): >>  File "", line 1, in >> TypeError: Can't instantiate abstract class D with abstract methods >> foo.__func__ > > You still need to use @abc.abstractstaticmethod. Thinking about this some more, I think the error you f

[issue11610] Improved support for abstract base classes with descriptors

2011-06-11 Thread Darren Dale
Darren Dale added the comment: On Sat, Jun 11, 2011 at 3:11 AM, Daniel Urban wrote: > > Daniel Urban added the comment: > > It doesn't work with staticmethod: > import abc class C(metaclass=abc.ABCMeta): > ...     @staticmethod > ...     @abc.abstractmethod > ...     def foo(x):

[issue11610] Improved support for abstract base classes with descriptors

2011-06-11 Thread Daniel Urban
Daniel Urban added the comment: It doesn't work with staticmethod: >>> import abc >>> >>> class C(metaclass=abc.ABCMeta): ... @staticmethod ... @abc.abstractmethod ... def foo(x): ... raise NotImplementedError() ... >>> class D(C): ... @staticmethod ... def foo

[issue11610] Improved support for abstract base classes with descriptors

2011-06-10 Thread Darren Dale
Changes by Darren Dale : -- components: +Library (Lib) -Interpreter Core ___ Python tracker ___ ___ Python-bugs-list mailing list Unsu

[issue11610] Improved support for abstract base classes with descriptors

2011-06-10 Thread Darren Dale
Changes by Darren Dale : Added file: http://bugs.python.org/file22323/abc_descriptors.patch ___ Python tracker ___ ___ Python-bugs-list mailin

[issue11610] Improved support for abstract base classes with descriptors

2011-06-10 Thread Darren Dale
Changes by Darren Dale : Removed file: http://bugs.python.org/file22322/abc_descriptors.patch ___ Python tracker ___ ___ Python-bugs-list mail

[issue11610] Improved support for abstract base classes with descriptors

2011-06-10 Thread Darren Dale
Darren Dale added the comment: Here is an improved patch, which includes feedback from python-dev. "make test" runs without failures, however test_abc.py prints deprecation warnings for abstractproperty. I'm not familiar with the protocol here, do we continue to include unit tests for depreca

[issue11610] Improved support for abstract base classes with descriptors

2011-06-10 Thread Darren Dale
Darren Dale added the comment: I posted the following at python-dev (http://mail.python.org/pipermail/python-dev/2011-June/111837.html): I would like to try to address some shortfalls with the way python deals with abstract base classes containing descriptors. I originally was just concerned w