Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #196352
| From | dieter.maurer@online.de |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Difference method vs attribut = function |
| Date | 2024-06-30 19:58 +0200 |
| Message-ID | <mailman.183.1719771822.2909.python-list@python.org> (permalink) |
| References | <20240628180854.7ee713db744e9672ad668f36@fam-goebel.de> <26241.40141.483093.401213@ixdm.fritz.box> |
Ulrich Goebel wrote at 2024-6-28 18:08 +0200: >Hi, > >a class can have methods, and it can have attributes, which can hold a function. Both is well known, of course. > >My question: Is there any difference? I think you should make the distinction "class versus instance attribute" rather than "mether versus function". If you look at the `__dict__` of an instance, you see only the instance variables (the class's `__dict__` gives you the (most) attributes of the class). You can access (most) class attributes via an instance; if a function is accessed in this way, it becomes (typically) a method.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Difference method vs attribut = function dieter.maurer@online.de - 2024-06-30 19:58 +0200
csiph-web