I cannot answer for Alperen, but I commonly encounter this when writing testing code: generally I use the format:
some_module.py tests/test_some_module.py where it is expected the filename to test a module is "test_module_name.py". However, within that, I might want to namespace based on the class in some_module.py. If you use something like unittest, classes are natural but if you use pytest it is unnecessary and commonly I end up with what Alperen has: marking everything as classmethod. What I have been looking for is a class/mixin/decorator that marks all methods I add as classmethods. Why bother marking as class_method? Well, I think it is bad practice where possible to have unused input in functions, even in testing code. Often I have made mistakes for example in copy-pasting and it would be caught if you look at unused variables and such matters. YMMV, but this, in some form, gets a +1 from me. On Tue, 6 Oct 2020 at 14:16, Irit Katriel via Python-ideas < python-ideas@python.org> wrote: > Hi Alperen, > > Why do you need a class at all rather than just a module with some > functions? > > Irit > > On Tuesday, October 6, 2020, 01:38:21 PM GMT+1, Alperen Keleş < > alpkele...@gmail.com> wrote: > > > Hi, > > Please pardon me if my idea is not making sense or already exists, I'm > kind of new to developing in Python but I had this idea today and I wanted > to share it with you. > > I think a class type such as "@functionclass" may be helpful for creating > functions intended to keep a list of methods in a scope. > > At the moment, I achieved this via writing "@classmethod" to all my > functions but I think such a decorator might help clarify intent for the > reader and ease the programmers' job. > > My regards, > Alperen > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@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/5FE6HAYMRR727HWRQXNQU6LWLCKFTBR2/ > Code of Conduct: http://python.org/psf/codeofconduct/ > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@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/YF6TUVHLE6U7DJPM2VCTS2MDK5KI42MK/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@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/IXS725PI22TK43GQOY55UB3DC5JBNF5S/ Code of Conduct: http://python.org/psf/codeofconduct/