Sujet : Re: Difference method vs attribut = function
De : mats (at) *nospam* wichmann.us (Mats Wichmann)
Groupes : comp.lang.pythonDate : 29. Jun 2024, 22:03:13
Autres entêtes
Message-ID : <mailman.181.1719692939.2909.python-list@python.org>
References : 1 2
User-Agent : Mozilla Thunderbird
On 6/28/24 10:08, Ulrich Goebel via Python-list wrote:
By the way: in my usecase I want to pass different functions to different instances of MyClass. It is in the context of a database app where I build Getters for database data and pass one Getter per instance.
If I understood what you're trying to accomplish, you could take a look here (possibly a bit complex for what you need).
https://refactoring.guru/design-patterns/strategy/python/example