It looks like there isn't a last word of the differrences
--
http://mail.python.org/mailman/listinfo/python-list
In article <[EMAIL PROTECTED]>,
Alex Martelli <[EMAIL PROTECTED]> wrote:
>Johnny Lee <[EMAIL PROTECTED]> wrote:
> ...
>> Thanks for your help, maybe I should learn how to turn an attibute into
>> a property first.
>
>Easy -- in your class's body, just code:
>
> def getFoo(self): ...
> def setFo
Johnny Lee <[EMAIL PROTECTED]> wrote:
> Alex Martelli ???
Now that's a peculiar question...
> > Johnny Lee <[EMAIL PROTECTED]> wrote:
> >
> > > But I still wonder what's the difference between the A().getMember and
> > > A().member besides the style
> >
> > Without parentheses after it, getMemb
Johnny Lee a écrit :
> Alex Martelli 写道:
>
>
>>Johnny Lee <[EMAIL PROTECTED]> wrote:
>>
>>
>>>But I still wonder what's the difference between the A().getMember and
>>>A().member besides the style
>>
>>Without parentheses after it, getMember is a method. The difference
>>between a method object
Alex Martelli 写道:
> Johnny Lee <[EMAIL PROTECTED]> wrote:
>
> > But I still wonder what's the difference between the A().getMember and
> > A().member besides the style
>
> Without parentheses after it, getMember is a method. The difference
> between a method object and an integer object (which i
Johnny Lee <[EMAIL PROTECTED]> wrote:
> But I still wonder what's the difference between the A().getMember and
> A().member besides the style
Without parentheses after it, getMember is a method. The difference
between a method object and an integer object (which is what member
itself is in your
Johnny Lee <[EMAIL PROTECTED]> wrote:
...
> Thanks for your help, maybe I should learn how to turn an attibute into
> a property first.
Easy -- in your class's body, just code:
def getFoo(self): ...
def setFoo(self, value): ...
def delFoo(self): ...
foo = property(getFoo, setFoo, delFo
But I still wonder what's the difference between the A().getMember and
A().member besides the style
--
http://mail.python.org/mailman/listinfo/python-list
Peter Otten 写道:
> Johnny Lee wrote:
>
> > Class A:
> >def __init__(self):
> > self.member = 1
> >
> >def getMember(self):
> > return self.member
> >
> > a = A()
> >
> > So, is there any difference between a.member and a.getMember? thanks
> > for your help. :)
>
> Yes. accessor
Johnny Lee wrote:
> Class A:
s/C/c/
>def __init__(self):
> self.member = 1
>
>def getMember(self):
> return self.member
>
> a = A()
>
> So, is there any difference between a.member and a.getMember?
yes : a.member is an integer, a.getMember is a bound method. You could
hav
Get answer by typing:
id(a.member)==id(a.getMember())
You will often find id() useful when in doubt whether the two objects
are distinct.
--
http://mail.python.org/mailman/listinfo/python-list
Johnny Lee wrote:
> Class A:
>def __init__(self):
> self.member = 1
>
>def getMember(self):
> return self.member
>
> a = A()
>
> So, is there any difference between a.member and a.getMember? thanks
> for your help. :)
Yes. accessor methods for simple attributes are a Javais
Class A:
def __init__(self):
self.member = 1
def getMember(self):
return self.member
a = A()
So, is there any difference between a.member and a.getMember? thanks
for your help. :)
Regards,
Johnny
--
http://mail.python.org/mailman/listinfo/python-list
13 matches
Mail list logo