On 5/14/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > On 5/14/07, Collin Winter <[EMAIL PROTECTED]> wrote: > > There really is no difference between roles and [EMAIL PROTECTED] > > ABCs. From my point of view, though, roles win because they don't > > require any changes to the interpreter; they're a much simpler way of > > expressing the same concept. > > Ok, you clearly have an implementation in mind, but I don't know what > it is. As far as I can tell: > > * metaclass=Role ~ metaclass=ABCMeta, except that all methods must be abstract > * perform_role(role)(cls) ~ role.register(cls) > * performs(obj, role) ~ isinstance(obj, role) > > And so, as far as I can see, without an Implementation section, all > you're propsing is a different syntax for the same functionality. Was > there a discussion of your implementation that I missed? > > > You may like adding the extra complexity > > and indirection to the VM necessary to support > > issubclass()/isinstance() overriding, but I don't. > > Have you looked at Guido's issubclass()/isinstance() patch > (http://bugs.python.org/1708353)? I'd hardly say that 34 lines of C > code is substantial "extra complexity".
This is what I don't understand: ABCs require changing the VM, roles don't; all that change buys you is the ability to spell "performs()" as "isinstance()". Why are ABCs preferable, again? Collin Winter _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com