What are static methods in Python and when to use them?



What are static methods in Python and when to use them?

What are static methods in Python and when to use them?

In this video we talk about static methods, basically “functions grouped in classes”.

We look at when and how to use them, namespacing + encapsulation they can provide, play with them, and show some practical examples in the wild.

We hope this helps you better understand them so next time you can more easily decide if you go with a plain function or a staticmethod in your class.

Links:
– Definition: https://twitter.com/bbelderbos/status/1598243053336133632
– Use cases: https://twitter.com/bbelderbos/status/1390926278476304384
– Were they a mistake? https://mail.python.org/pipermail/python-ideas/2016-July/041189.html
– Classmethods video last week: https://www.youtube.com/watch?v=5Yb0kiUvWwY
– Pybites OOP learning path: https://codechalleng.es/bites/paths/oop


Learn more about Pybites / what we do: https://pybit.es

Get our weekly developer / mindset emails: https://pybit.es/friends/

Join our Slack community: https://pybit.es/community/

And last but not least, we appreciate any feedback to make our YouTube content better 💡
https://form.jotform.com/230941798741062 🙏

Comments are closed.