I am reading a book where the author says that:

In principle, it would also be possible to implement any @staticmethod 
completely outside of the class at module scope without any loss of 
functionality — so you may want to consider carefully whether a particular 
function should be a module scope function or a static method. The 
@staticmethod decorator merely facilitates a particular organisation of the 
code allowing us to place what could otherwise be free functions within classes.

I didn’t get quiet well this block of text. My first question is how would I 
make a module level function as static method of a class. Can anyone give me an 
example of this? What are the contexts that would let you to think if they are 
good fit inside the class or module level scope functions?


Thanks,

Arup Rakshit
a...@zeit.io



-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to