Re: [Python-Dev] Can we improve support for abstract base classes with desciptors

2011-06-09 Thread Nick Coghlan
On Thu, Jun 9, 2011 at 9:45 PM, Darren Dale wrote: > What do you think about deprecating > abstractproperty, or removing it from the documentation? Unless anyone specifically howls at the idea, +1 to both (since abstractproperty doesn't actually achieve the intended purpose and will become redund

Re: [Python-Dev] Can we improve support for abstract base classes with desciptors

2011-06-09 Thread Darren Dale
On Wed, Jun 8, 2011 at 10:01 PM, Nick Coghlan wrote: > On Thu, Jun 9, 2011 at 8:51 AM, Darren Dale wrote: >>>       for base in bases: >>>           for name in getattr(base, "__abstractmethods__", ()): >>>               # CHANGE 4: Using rpartition better tolerates weird >>> naming in the metacl

Re: [Python-Dev] Can we improve support for abstract base classes with desciptors

2011-06-08 Thread Nick Coghlan
On Thu, Jun 9, 2011 at 8:51 AM, Darren Dale wrote: > That should be "get_abstract_names(namespace)", since ns.items() gets > called again in the for loop. I think the get_abstract_names function > isn't needed though, since it is only ever called that one time. Any > reason not replace the above b

Re: [Python-Dev] Can we improve support for abstract base classes with desciptors

2011-06-08 Thread Darren Dale
On Wed, Jun 8, 2011 at 11:55 AM, Nick Coghlan wrote: > On Thu, Jun 9, 2011 at 1:01 AM, Darren Dale wrote: > [snip excellent analysis of the problem] > > I have some suggestions regarding a few details of your current code, > but your basic proposal looks sound to me. > > I would tweak __new__ alo

Re: [Python-Dev] Can we improve support for abstract base classes with desciptors

2011-06-08 Thread Nick Coghlan
On Thu, Jun 9, 2011 at 1:01 AM, Darren Dale wrote: [snip excellent analysis of the problem] I have some suggestions regarding a few details of your current code, but your basic proposal looks sound to me. I would tweak __new__ along the following lines though: def __new__(mcls, name, bases,

[Python-Dev] Can we improve support for abstract base classes with desciptors

2011-06-08 Thread Darren Dale
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 with improving support for defining abstract properties with the decorator syntax and converting between abstract and concrete properties, but