use of "self", was "No Do while/repeat until looping construct in python?"
William Sonna
wsonna at attglobal.net
Tue Mar 18 04:22:54 EST 2003
On Sun, 16 Mar 2003 16:53:46 -0800, Dennis Lee Bieber wrote:
> Delaney, Timothy C (Timothy) fed this fish to the penguins on Sunday 16
> March 2003 03:09 pm:
>
>>> From: William Sonna [mailto:wsonna at attglobal.net]
>>>
>>> There actually is another alternative - mass qualification.
>>>
>>> There is/(was)? a scripting lanuage that uses/(d)? the following:
>>>
>>> ::method tag
>>> expose name address salutation
>>> separator = 'at:'
>>> return salutation name separator address
>>
>> Ah - the common "with" suggestion.
>
> Looks like a reference to ObjectREXX...
>
> Though "expose" could be considered closer to Python's "global", just
> class specific -- naming those items which are part of the
> class/instance variable pool. I'll steal from FORTRAN and use "common"
> in the pseudo code below...
>
> class Klass(): #python would have...
> def __init__(n, a, s, t): #__init(self, n, a, s, t)
> common name #remove
> common address #remove
> common salutation #remove
> common title #remove
> name = n #self.name = n
> address = a #self.address = a
> salutation = s #self.salutation = s
> title = t #self.title = t
> def tag(): #tag(self)
> common name #remove all three common statements
> common address #NOTE: this has NO access to title
> common salutation #even though it is a method
> return salutation name 'at:' address #REXX concats with spaces
> # return "%s %s at: %s" % (self.salutation,
> # self.name, self.address)
>
> (x)REXX does not have nested scope, nor does it have "globals" -- one
> has to declare (expose) anything shared between procedures and main.
Two points:
1. In Python, you would be more likely to say "common name, address,
salutation, title".
2. Unnamed scritping language defines instance variables to be private,
ie, there are rules/limits on what can ever be "common" or "exposed".
More information about the Python-list
mailing list