Ron Adam wrote:
> What I've noticed is you can block the visibility of a class attribute,
> which include methods, by inserting an object in the instance with the
> same name.
>
[snip example of this behavior]
Yes, that's true for "non-data descriptors" (see last two bullets below)
Raymond Het
Diez B. Roggisch wrote:
>> This still seems not quite right to me... Or more likely seems to be
>> missing something still.
>>
>> (But it could be this migraine I've had the last couple of days
>> preventing me from being able to concentrate on things with more than
>> a few levels of complexit
> This still seems not quite right to me... Or more likely seems to be
> missing something still.
>
> (But it could be this migraine I've had the last couple of days
> preventing me from being able to concentrate on things with more than a
> few levels of complexity.)
>
> Playing around with
Michael Spencer wrote:
> All is explained at:
> http://users.rcn.com/python/download/Descriptor.htm#functions-and-methods
> and further at:
> http://www.python.org/pycon/2005/papers/36/pyc05_bla_dp.pdf
>
> "For objects, the machinery is in object.__getattribute__ which
> transforms b.x into type
Ron Adam wrote:
> Erik Max Francis wrote:
>
>>Ron Adam wrote:
>>
>>
>>>When you call a method of an instance, Python translates it to...
>>>
>>> leader.set_name(leader, "John")
>>
>>
>>It actually translates it to
>>
>>Person.set_name(leader, "John")
>>
>
>
> I thought that I might have
Erik Max Francis wrote:
> Ron Adam wrote:
>
>> When you call a method of an instance, Python translates it to...
>>
>> leader.set_name(leader, "John")
>
>
> It actually translates it to
>
> Person.set_name(leader, "John")
>
I thought that I might have missed something there.
Is ther
On Friday 23 September 2005 10:41 am, Rick Wotnaz wrote:
> Oh, 'ix' would be fine. Single-letter loop counters are also semi-
> fine if that is in fact their only use. It too-frequently happens
> that at some point the handy 'i' identifier is used outside the
> loop (for another placeholder), and
On Friday 23 September 2005 10:42 am, Peter wrote:
> Terry Hancock wrote:
> >How exactly is that? Anybody who uses "i" as a variable name for
> >anything other than an innermost loop index is a sick and twisted
> >code sadist.
> >
> Agreed, though to say "code sadist" is a little hard don't ya thi
Terry Hancock <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> On Friday 23 September 2005 07:11 am, Rick Wotnaz wrote:
>> I've long thought that Guido missed an opportunity by not
>> choosing to use 'i' as the instance identifier, and making it a
>> reserved word. For one thing, it would r
Terry Hancock wrote:
>On Friday 23 September 2005 07:11 am, Rick Wotnaz wrote:
>
>
>>I've long thought that Guido missed an opportunity by not choosing
>>to use 'i' as the instance identifier, and making it a reserved
>>word. For one thing, it would resonate with the personal pronoun
>>'I', a
On Friday 23 September 2005 07:11 am, Rick Wotnaz wrote:
> I've long thought that Guido missed an opportunity by not choosing
> to use 'i' as the instance identifier, and making it a reserved
> word. For one thing, it would resonate with the personal pronoun
> 'I', and so carry essentially the s
Rick Wotnaz <[EMAIL PROTECTED]> wrote:
>I've long thought that Guido missed an opportunity by not choosing
>to use 'i' as the instance identifier, and making it a reserved
>word. For one thing, it would resonate with the personal pronoun
>'I', and so carry essentially the same meaning as 'self'
Rick Wotnaz wrote:
> Roy Smith <[EMAIL PROTECTED]> wrote in
> news:[EMAIL PROTECTED]:
>
>
>>Ron Adam <[EMAIL PROTECTED]> wrote:
>>
>>>You can actually call it anything you want but "self" is sort
>>>of a tradition.
>>
>>That's true, but I think needs to be said a bit more
>>emphatically. There'
Roy Smith <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> Ron Adam <[EMAIL PROTECTED]> wrote:
>> You can actually call it anything you want but "self" is sort
>> of a tradition.
>
> That's true, but I think needs to be said a bit more
> emphatically. There's no reason to call it anything
Ron Adam <[EMAIL PROTECTED]> wrote:
> You can actually call it anything you want but "self" is sort of a
> tradition.
That's true, but I think needs to be said a bit more emphatically. There's
no reason to call it anything other than "self" and a newcomer to the
language would be well advised
Ron Adam wrote:
> When you call a method of an instance, Python translates it to...
>
> leader.set_name(leader, "John")
It actually translates it to
Person.set_name(leader, "John")
--
Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20
I'm sure there are answers to this out there, but I'm typing this one up so I
can show it to people that I try to teach this language. They consistently
get hung up on what self is. So here is my try:
==
Self is one of those python concepts that new python programmers have a little
difficulty
Wayne Sutton wrote:
> OK, I'm a newbie...
> I'm trying to learn Python & have had fun with it so far. But I'm having
> trouble following the many code examples with the object "self." Can
> someone explain this usage in plain english?
>
> Thanks,
> Wayne
I'll give it a try..
When you have
On Thu, 2005-09-22 at 21:36 -0400, Wayne Sutton wrote:
> OK, I'm a newbie...
> I'm trying to learn Python & have had fun with it so far. But I'm having
> trouble following the many code examples with the object "self." Can
> someone explain this usage in plain english?
"self" references the ob
self is the class instance that the bound function being called belongs
to. This example should illustrate a bit.
class Foo(object):
def __init__(self, value):
self.value = value # so the Foo instance now has an attribute,
value
def get_value(self):
return self.value # Th
OK, I'm a newbie...
I'm trying to learn Python & have had fun with it so far. But I'm having
trouble following the many code examples with the object "self." Can
someone explain this usage in plain english?
Thanks,
Wayne
--
http://mail.python.org/mailman/listinfo/python-list
21 matches
Mail list logo