Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #196348

Re: Difference method vs attribut = function

From Mats Wichmann <mats@wichmann.us>
Newsgroups comp.lang.python
Subject Re: Difference method vs attribut = function
Date 2024-06-29 14:03 -0600
Message-ID <mailman.181.1719692939.2909.python-list@python.org> (permalink)
References <20240628180854.7ee713db744e9672ad668f36@fam-goebel.de> <5804d7a6-c434-4e03-bf44-f84f836536dd@wichmann.us>

Show all headers | View raw


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


Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Difference method vs attribut = function Mats Wichmann <mats@wichmann.us> - 2024-06-29 14:03 -0600

csiph-web