开发者

Does it make sense to make a class in python when it would never get instantiated?

开发者 https://www.devze.com 2023-03-29 01:43 出处:网络
I have some methods in a file and all of them are defined in the global scope (a module). I did not bother to make a class because the class would never get instantiated and everything would still开发

I have some methods in a file and all of them are defined in the global scope (a module). I did not bother to make a class because the class would never get instantiated and everything would still开发者_StackOverflow社区 have to be accessed statically if I defined a class. Does it make sense to leave it as it is, or is it better design to make a class and make all my methods static? and why?

FYI: My script methods will get accessed by third party users.


Python is not Java, use module-level methods without worry.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号