[issue12128] Allow `abc.abstractproperty` to be overridden by a data attribute

2011-05-20 Thread Daniel Urban
Changes by Daniel Urban : -- nosy: +durban ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.o

[issue12128] Allow `abc.abstractproperty` to be overridden by a data attribute

2011-05-20 Thread Eric Snow
Eric Snow added the comment: As far as I have found, there isn't a way to make it work implicitly without changing object.__new__. I just posted some of the approaches I could think of to python-list: http://mail.python.org/pipermail/python-list/2011-May/1272604.html Mostly it is a matter

[issue12128] Allow `abc.abstractproperty` to be overridden by a data attribute

2011-05-20 Thread Ram Rachum
Ram Rachum added the comment: Ah, I got confused, there's no way we can call `__init__` in `ABCMeta.__new__`. -- ___ Python tracker ___ _

[issue12128] Allow `abc.abstractproperty` to be overridden by a data attribute

2011-05-20 Thread Ram Rachum
Ram Rachum added the comment: Eric, do you think that a solution can be made by calling `__init__` inside of `ABCMeta.__new__` and then afterwards checking the instance for attributes? -- ___ Python tracker _

[issue12128] Allow `abc.abstractproperty` to be overridden by a data attribute

2011-05-20 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: > Daniel, the behavior you describe is already present in Python 3.2. Awesome. :) Do you have a compelling use-case for making "self.x = 5" satisfy an abstractproperty requirement? One of the problems with that approach is that the instance does not satis

[issue12128] Allow `abc.abstractproperty` to be overridden by a data attribute

2011-05-20 Thread Ram Rachum
Ram Rachum added the comment: Daniel, the behavior you describe is already present in Python 3.2. -- ___ Python tracker ___ ___ Pytho

[issue12128] Allow `abc.abstractproperty` to be overridden by a data attribute

2011-05-20 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I misread the original request. I'm +1 on making the following work, if it doesn't work already: class MySubClass(MyAbstractClass): SOME_LIMIT = 5 # Implements abstract property with fixed value We should be able to check that at instance creation tim

[issue12128] Allow `abc.abstractproperty` to be overridden by a data attribute

2011-05-20 Thread Eric Snow
Eric Snow added the comment: Wow! I was literally working on this problem yesterday. The abstract check is done at instantiation time (in object.__new__, typeobject.c). So as it stands __new__ has no way to validate that all your abstract properties have been implemented unless they are ac

[issue12128] Allow `abc.abstractproperty` to be overridden by a data attribute

2011-05-20 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: SGTM. I've written code where this would have been useful. Could you write a patch? -- nosy: +stutzbach stage: -> needs patch ___ Python tracker _

[issue12128] Allow `abc.abstractproperty` to be overridden by a data attribute

2011-05-20 Thread Ram Rachum
New submission from Ram Rachum : When you create an `abc.abstractproperty` on a class, any subclass must override it as an actual property in order to be instantiable. But sometimes you want to override it with a data attribute instead, i.e. `self.x = 5` instead of `x = property(...)`. It woul