On Wed, Jun 8, 2011 at 10:01 PM, Nick Coghlan <ncogh...@gmail.com> wrote: > On Thu, Jun 9, 2011 at 8:51 AM, Darren Dale <dsdal...@gmail.com> wrote: >>> for base in bases: >>> for name in getattr(base, "__abstractmethods__", ()): >>> # CHANGE 4: Using rpartition better tolerates weird >>> naming in the metaclass >>> # (weird naming in descriptors will still blow up in >>> the earlier search for abstract names) >> >> Could you provide an example of weird naming? > >>>> class C(object): > ... pass > ... >>>> setattr(C, 'weird.name', staticmethod(int)) [...]
> This is definitely something that could legitimately be dismissed as > "well, don't do that then" (particularly since similarly weird names > on the descriptors will still break). However, I also prefer the way > partition based code reads over split-based code, so I still like the > modified version. Yes, I like your modified version as well. I just wanted to understand your concern, since it had never occurred to me to try something like "setattr(C, 'pathological.name', ...)". > Full tolerance for weird naming would require storing 2-tuples in > __abstractmethods__ which would cause a whole new set of problems and > isn't worth the hassle. I'm glad you feel that way. I'll work on a patch that includes docs and unit tests and post it at http://bugs.python.org/issue11610. What do you think about deprecating abstractproperty, or removing it from the documentation? Darren _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com