wasm-demo/demo/ermis-f/python_m/cur/0407

40 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

From: geek+ at cmu.edu (geek+ at cmu.edu)
Date: 5 Apr 1999 12:36:56 -0400
Subject: Subattributes of classes
Message-ID: <emacs-smtp-4003-14088-59048-707739@export.andrew.cmu.edu>
Content-Length: 1328
X-UID: 407
Then <cgw at fnal.gov> spoke up and said:
> Randall Hopper wrote:
>
> > Why?
>
> Because "attr" in class A is just an int, and has no attributes,
> whereas "draw" in the Tkinter demo is a Canvas object, which has a
> scrollX and scrollY attribute.
Actually, this is both right and wrong. It doesn't matter whether or
not the object has attributes. What matters is whether or not the
object is mutable. An integer object is not mutable. This is one of
the reasons there is no increment operator for integers. Such an
operation is usually semantically "in place", where it would have to
be a factory function (like +) in Python.
--
=====================================================================
| JAVA must have been developed in the wilds of West Virginia. |
| After all, why else would it support only single inheritance?? |
=====================================================================
| Finger geek at cmu.edu for my public key. |
=====================================================================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 266 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/19990405/f4c2be79/attachment.sig>