[issue10868] ABCMeta.register() should work as a decorator

2011-02-26 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Sounds good to me. Thanks for the clarifications and satisfying my curiosity! :-) -- ___ Python tracker ___ ___

[issue10868] ABCMeta.register() should work as a decorator

2011-02-26 Thread Daniel Urban
Daniel Urban added the comment: > In what use-cases would you want to call MyABC.register() when defining > a class instead of inheriting from MyABC? For example if you don't want to inherit a __dict__ for a tree-like data structure (see also issue11333). -- _

[issue10868] ABCMeta.register() should work as a decorator

2011-02-26 Thread Edoardo Spadolini
Edoardo Spadolini added the comment: Not really, but putting something in your inheritance lattice only to mark a class as providing an interface just doesn't seem right to me. -- ___ Python tracker _

[issue10868] ABCMeta.register() should work as a decorator

2011-02-24 Thread Éric Araujo
Éric Araujo added the comment: Someone may want to register with an ABC but not inherit methods or add a class to the mro. It’s always been allowed by the register method; the new decorator feature is just a very minor nicety on top of that. Edoardo, was your request motivated by a real use

[issue10868] ABCMeta.register() should work as a decorator

2011-02-24 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: In what use-cases would you want to call MyABC.register() when defining a class instead of inheriting from MyABC? I always thought of the register() as hack to make it possible to support types written in C, which can't inherit from the ABC. -- nos

[issue10868] ABCMeta.register() should work as a decorator

2011-02-24 Thread Éric Araujo
Éric Araujo added the comment: Committed to py3k as r88545. You’ll notice that I fixed the nesting of the versionchanged directive and that I changed my mind about “returns”. Thanks again! -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___

[issue10868] ABCMeta.register() should work as a decorator

2011-01-11 Thread Edoardo Spadolini
Edoardo Spadolini added the comment: Yeah, I should've waited for the test to finish, but come on, "it was just a small change" :( Now I know why you should always test everything at least, sorry about that :) -- ___ Python tracker

[issue10868] ABCMeta.register() should work as a decorator

2011-01-10 Thread Éric Araujo
Éric Araujo added the comment: -return # Already a subclass +return subclass # Already a subclass PEP 8 advises to put two spaces before inline comments, for readability. (There is no need to upload a new patch, I’ll change that before commit.) +self.assertIsIn

[issue10868] ABCMeta.register() should work as a decorator

2011-01-10 Thread Edoardo Spadolini
Changes by Edoardo Spadolini : Added file: http://bugs.python.org/file20337/abcmeta_register_v4_plus_tests.diff ___ Python tracker ___ ___ Pyt

[issue10868] ABCMeta.register() should work as a decorator

2011-01-10 Thread Edoardo Spadolini
Changes by Edoardo Spadolini : Removed file: http://bugs.python.org/file20336/abcmeta_register_v4_plus_tests.diff ___ Python tracker ___ ___

[issue10868] ABCMeta.register() should work as a decorator

2011-01-10 Thread Edoardo Spadolini
Edoardo Spadolini added the comment: Fair enough :) -- Added file: http://bugs.python.org/file20336/abcmeta_register_v4_plus_tests.diff ___ Python tracker ___ __

[issue10868] ABCMeta.register() should work as a decorator

2011-01-10 Thread Éric Araujo
Éric Araujo added the comment: You should, otherwise how would you prove it’s fixed? :) -- ___ Python tracker ___ ___ Python-bugs-lis

[issue10868] ABCMeta.register() should work as a decorator

2011-01-10 Thread Edoardo Spadolini
Changes by Edoardo Spadolini : -- nosy: +benjamin.peterson, durban, eric.araujo, gvanrossum, pitrou, rhettinger ___ Python tracker ___ ___

[issue10868] ABCMeta.register() should work as a decorator

2011-01-10 Thread Edoardo Spadolini
Edoardo Spadolini added the comment: Whoops, corrected that - should I add some more tests for that too? -- nosy: -benjamin.peterson, durban, eric.araujo, gvanrossum, pitrou, rhettinger Added file: http://bugs.python.org/file20335/abcmeta_register_v4.diff _

[issue10868] ABCMeta.register() should work as a decorator

2011-01-10 Thread Daniel Urban
Daniel Urban added the comment: There is another return statement earlier in the ABCMeta.register method. The patch probably should also modify that. -- nosy: +durban ___ Python tracker __

[issue10868] ABCMeta.register() should work as a decorator

2011-01-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: +1 -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue10868] ABCMeta.register() should work as a decorator

2011-01-08 Thread Éric Araujo
Éric Araujo added the comment: Edited your patch to fix some nits. If there is no opposition, I’ll commit this to py3k when 3.2 is out. -- Added file: http://bugs.python.org/file20316/abcmeta_register_v3.diff ___ Python tracker

[issue10868] ABCMeta.register() should work as a decorator

2011-01-08 Thread Edoardo Spadolini
Edoardo Spadolini added the comment: Ok, edited the docs too; hope I did everything right... -- Added file: http://bugs.python.org/file20315/abcmeta_register_deco_with_docs.diff ___ Python tracker ___

[issue10868] ABCMeta.register() should work as a decorator

2011-01-08 Thread Éric Araujo
Éric Araujo added the comment: Thanks for the report and patch. Some comments: +"""Register a virtual subclass of an ABC. Returns the said subclass.""" Should be “Return”, for consistency. +return subclass # For usage as a decorator I’d move that to the docstring. Can you ed

[issue10868] ABCMeta.register() should work as a decorator

2011-01-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: Looks like a good idea to me. -- nosy: +benjamin.peterson, gvanrossum, pitrou stage: -> patch review ___ Python tracker ___ __

[issue10868] ABCMeta.register() should work as a decorator

2011-01-08 Thread Edoardo Spadolini
New submission from Edoardo Spadolini : If we make ABCMeta.register() return the registered class, like atexit.register() does for the registered function, we can then use it as a decorator: Now: class Foo: ... ABarC.register(Foo) With this change: @ABarC.register class Foo: ... Th