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


Groups > comp.lang.python > #196352

Re: Difference method vs attribut = function

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From dieter.maurer@online.de
Newsgroups comp.lang.python
Subject Re: Difference method vs attribut = function
Date Sun, 30 Jun 2024 19:58:37 +0200
Lines 16
Message-ID <mailman.183.1719771822.2909.python-list@python.org> (permalink)
References <20240628180854.7ee713db744e9672ad668f36@fam-goebel.de> <26241.40141.483093.401213@ixdm.fritz.box>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de 1qqBTx6Dmow7KS8uxnNxUwPGXc3cSqNsyLOC1JXJWtpw==
Cancel-Lock sha1:uhdN05wL5RkhfuW7ZJJvN+EYRcQ= sha256:thJJLGuhj4VEizyk3QS/EwPJOjTo5jYzQcEgdy8Swic=
Return-Path <dieter.maurer@online.de>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
Authentication-Results mail.python.org; dkim=pass reason="2048-bit key; unprotected key" header.d=online.de header.i=dieter.maurer@online.de header.b=jP9wnmP2; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status OK 0.021
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'received:212.227': 0.07; 'cc:addr:python-list': 0.09; 'methods,': 0.09; 'question:': 0.09; 'received:212.227.126': 0.09; 'cc:no real name:2**0': 0.14; 'accessed': 0.16; 'attributes': 0.16; 'attributes,': 0.16; 'instance': 0.16; 'subject: = ': 0.16; 'cc:addr:python.org': 0.20; 'received:de': 0.23; 'cc:2**0': 0.25; 'function': 0.27; 'think': 0.32; 'course.': 0.32; 'received:kundenserver.de': 0.32; 'received:mout.kundenserver.de': 0.32; 'there': 0.33; 'hold': 0.33; 'header:In-Reply-To:1': 0.34; 'class': 0.37; 'received:192.168': 0.37; 'wrote': 0.39; 'both': 0.40; 'should': 0.40; 'gives': 0.62; 'received:212': 0.62; 'becomes': 0.64; 'look': 0.65; 'well': 0.65; 'subject:method': 0.69; 'distinction': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=online.de; s=s42582890; t=1719771819; x=1720376619; i=dieter.maurer@online.de; bh=iVbpkPkSnm4FPtB8TZgj8qiRrnEEzgq2qn3o7x7oa1I=; h=X-UI-Sender-Class:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-ID:Date:From:To:Cc:Subject: In-Reply-To:References:cc:content-transfer-encoding:content-type: date:from:message-id:mime-version:reply-to:subject:to; b=jP9wnmP2DgZspoGmTX6yQLUq4ysqnxQ14KBEHqZo0E59odJNRwoU1pvvNFIhAswg C9IbYw2qbNuU7uvvH0R+Wq9sqRNvzU7Em9kdwsRGhA89E4/RkloQAzVM1G3S1LYAb tdPElpWZZKlsb5Gg3m/UMs0sXJdxETjo8Cr5/9MC2ov4v8D4yOz71gshb5dMAkTS6 0nPAHfm/l8JNgNs7FbU3KvL2UqrdSz+ojLogqUb9IXf8GQTb6yWg6dqaJQOylZwuH HD3eoBmFA1t2/C+kjBWy8yh9oLzxPzvJyH6KQfz4czqEBEfBPLGD+IBvUMLCqw8aI 0WROVXTsJZTx33yStw==
X-UI-Sender-Class 6003b46c-3fee-4677-9b8b-2b628d989298
In-Reply-To <20240628180854.7ee713db744e9672ad668f36@fam-goebel.de>
X-Mailer VM 8.0.12-devo-585 under 21.4 (patch 24) "Standard C" XEmacs Lucid (x86_64-linux-gnu)
X-Provags-ID V03:K1:rgxmN6DsENFza+LOOxr+SnJYbIYcVS4NqN0D2Eozs0UNA2PA7T9 axMksb66LNnUCyRGJ/IVuNFUTxIgpar4LxC5Fm6dMLEZf8I9dCGDFL7feeL7lGZXFoFgA05 8kiZReI7E0ImrUcYj6KZhReG4hbJvzz7mFM9eCQfa5VrcVqni7RFoXyWz39WUr04AGe2aEc mtFR5d2kl3G2vAkmJG9Xw==
X-Spam-Flag NO
UI-OutboundReport notjunk:1;M01:P0:r4J2a5Egufo=;v19JtkHAfBWvNXSFPAvWqyxRLrd do6PVul1OyncttAUbiklhpEKfKd5z3y0Dp/EDg1G0TM5c7bLnswFNIoZm4HHk7/ptqf0qoGpE sVXCaaDYsSq/ON+sV9nAKESYPk5yIkjypHk/iFTpMEzYSuTRl4ktnzdiE+9mOe+a/JFEsS4Ax 6O//uPhauO1X7IcD18Oy2cQJzva4/ak2gQI/QRnL+qBDGMKN2EBUHigb8cotosQvlYcSWmZp0 XTg7r4bzmwRFkymtptK8zTWq5JIPHiS6H5EeqfDY8I9cDE0WI+2fQ8VhoTSG9wyHL1HFPFAbL zKBXboMMNBaK/dX0xLBGCU2rwCf4saCVM2umuTNfZcGsWT0GsB+M/SnF/EgN1e4XSBDwz4c6Z bfjoGqK0Uc13ka4LNbf4046aNJjiHc65jNR9qVJ3jZLvFFZv2WMaXyCt14tBO6QzHMSm9qqvt CG81SqtK0N6X9z7OKW6N3U7bijpP6AourZJ70sAmrppI+UHAZd4Mgf20u0esNrJSwNs+DN6mU ZyLgbbXmNgERQQEYyx7m1CRzJ4hfBqELsYuGu0U1sXAWx3VC2t3JyKKpav9phbSyzPpK7MAf5 4SpzKc7+lW0k8Jdu+LC1+oeMzmtfs/MoF0b8DmeLYoykBTFtyyadVQIWuN/OGKE+5XI5PnkY7 Ox6KNiugb9mXIAamOSbk89+1xJbdBdj93UIF0N47hrC5xajpQBYeAYULRxn/I08ZKDRYmxjj/ v3o/PxRuyxzriLq1EkhyEjSLNdTLUdoX5fD1o2WJaKHnjvAb35VFh4=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.39
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <https://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <26241.40141.483093.401213@ixdm.fritz.box>
X-Mailman-Original-References <20240628180854.7ee713db744e9672ad668f36@fam-goebel.de>
Xref csiph.com comp.lang.python:196352

Show key headers only | View raw


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


Thread

Re: Difference method vs attribut = function dieter.maurer@online.de - 2024-06-30 19:58 +0200

csiph-web