[Python-ideas] class-only methods without using metaclasses

Eric Snow ericsnowcurrently at gmail.com
Fri Mar 8 17:45:51 CET 2013


On Fri, Mar 8, 2013 at 4:15 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> It's the "When would I recommend using this over a normal
> classmethod?" that I consider subtle. By only providing one of the two
> options directly, it means people don't even need to ask the question,
> let alone figure out how to answer it.

And this is where I agree.  I will say that the proper implementation
isn't trivial and my recipe is only pretty close.  If it were more
frequently useful, I'd press for a classonlymethod() in the standard
library (not builtins).  If that changes I'll bring it up again, but
for now I'm not convinced it is worth it.

-eric



More information about the Python-ideas mailing list