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

Edoardo Spadolini report at bugs.python.org
Sun Jan 9 00:32:13 CET 2011


New submission from Edoardo Spadolini <kerio00 at gmail.com>:

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:
    ...

The only problem this would cause is in code that relies on ABCMeta.register() to return None; I can't think of a reason anyone would rely on this, but...

----------
components: Library (Lib)
files: abcmeta_register_deco.diff
keywords: patch
messages: 125804
nosy: kerio
priority: normal
severity: normal
status: open
title: ABCMeta.register() should work as a decorator
type: feature request
versions: Python 3.3
Added file: http://bugs.python.org/file20314/abcmeta_register_deco.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10868>
_______________________________________


More information about the Python-bugs-list mailing list