I think the OP would be happy with a decorator they can just copy-paste. All it needs to do is go over the class dict and apply @classmethod to every “normal” function. Probably skip under names.

On Tue, Oct 6, 2020 at 06:46 Ricky Teachey <ricky@teachey.org> wrote:
cf. this relatively recent conversation on the same topic-- worth reading in entirety:


As I said in that conversation, in the past I have wanted to have module-like namespaces inside of modules because sometimes it makes organizational sense to not create a separate, very short, module file.  

Summary of how that thread turned out:

There seemed to be agreement among most of the conversation participants that this would be a useful idea, and a few different syntax ideas were batted about (a decorator, totally new syntax). A few people have experimented with various ways of doing this using current python but all of the ideas anyone has come up with so far would require some kind of change to the core language to make them work. The conversation didn't go any further than that (to my knowledge).


---
Ricky.

"I've never met a Kentucky man who wasn't either thinking about going home or actually going home." - Happy Chandler
 
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/QRZXD7PJMGZ5SOJTU2X3I3ZOU6YCTPAE/
Code of Conduct: http://python.org/psf/codeofconduct/
--
--Guido (mobile)