i want to expand specifically on steve's response and note the big
distinction that needs to be made for everyone is that this is primary the
difference between calling a *function* and calling a *method* (which is a
function that belongs to/defined for a class).
with that instance (self), that me
This little thread on the usage of self references when calling class instance
methods and attributes was excellent, one of the best I have seen.
Thanks,
Bill Allen
Sent from my iPhone
On Mar 12, 2012, at 3:56, Alan Gauld wrote:
> On 12/03/12 02:02, Michael Lewis wrote:
>
>> I have another me
On 12/03/12 02:02, Michael Lewis wrote:
I have another method called take turns (not shown for brevity
purposes). When I want to call it, why can't I just call it like a
function and use TakeTurns() instead of self.TakeTurns()?
The Steve's have given technical answers, its also stylistically
b
On 11-Mar-12 20:03, Steven D'Aprano wrote:
On Sun, Mar 11, 2012 at 07:02:11PM -0700, Michael Lewis wrote:
Why do I have to use "self.example" when calling a method inside a class?
For example:
def Play(self):
'''find scores, reports winners'''
self.scores = []
f
On Sun, Mar 11, 2012 at 07:02:11PM -0700, Michael Lewis wrote:
> Why do I have to use "self.example" when calling a method inside a class?
>
> For example:
>
> def Play(self):
> '''find scores, reports winners'''
> self.scores = []
> for player in range(self.players):
Why do I have to use "self.example" when calling a method inside a class?
For example:
def Play(self):
'''find scores, reports winners'''
self.scores = []
for player in range(self.players):
print
print 'Player', player + 1
self.score