IsPython really O-O?
gh_pythonlist at gmx.de
Tue Nov 13 20:23:51 CET 2001
On Tue, Nov 13, 2001 at 11:59:00AM -0700, Andrew Dalke wrote:
> When I first started Python, I wrote a class like:
> class Spam:
> def __init__(self, x):
> self.x = x
> def show(self):
> print self.x
> After I figured out it worked, I wanted to add a new method, so
> I did
> class Spam:
> def double(self):
> self.x = self.x * 2
> then was annoyed that it didn't work the way I expected. So I
> don't think you are alone in this view. I bring it up here because
> I suspect for many people this is forgotten amoung all the other
> confusions in the early stages of learning Python.
Hey, you could have written:
It doesn't really add a method to the class, but at least it looks nicer.
What I miss(ed) was overloadable function and method signatures.
The information transmitted in this message (if any) is intended only for the
person or entity to which it is addressed. The message may contain
confidential and/or privileged material. It doesn't really matter, we will
append this lengthy legalese mumbo-jumbo anyway. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance upon this
information, by persons or entities other than the intended recipient is
prohibited. The same goes for the intended recipient herself.
If you have received this in error, please contact your lawyer and delete this
e-mail and everything else from any computer in your vicinity.
The intended recipient of this e-mail may only use, reproduce, disclose or
distribute the information contained in this e-mail and any attached files,
with the permission of BigBrother Inc.
This message has been scanned for anti-Microsoft propaganda and cleared by
More information about the Python-list