RE: Classes - converting external function to class's method.

2014-12-15 Thread Ivan Evstegneev
t; From: Python-list [mailto:python-list- > bounces+webmailgroups=gmail@python.org] On Behalf Of Steven > D'Aprano > Sent: Monday, December 15, 2014 04:01 > To: python-list@python.org > Subject: Re: Classes - converting external function to class's method. > > Thomas 'Poi

Re: Classes - converting external function to class's method.

2014-12-14 Thread Steven D'Aprano
Thomas 'PointedEars' Lahn wrote: > Ivan Evstegneev wrote: > >> I have stuck a bit with this example(took this one from the book). >> >> Here are a description steps of what I've done till now: >> >> >> Step 1 - creating an empty namespace: >> >class rec: pass > > IMHO that is not actual

Re: Classes - converting external function to class's method.

2014-12-14 Thread Thomas 'PointedEars' Lahn
Terry Reedy wrote: > On 12/14/2014 6:15 PM, Thomas 'PointedEars' Lahn wrote: >> Ivan Evstegneev wrote: >>> I have stuck a bit with this example(took this one from the book). >>> >>> Here are a description steps of what I've done till now: >>> >>> Step 1 - creating an empty namespace: >>> >> cl

Re: Classes - converting external function to class's method.

2014-12-14 Thread Terry Reedy
On 12/14/2014 6:15 PM, Thomas 'PointedEars' Lahn wrote: Ivan Evstegneev wrote: I have stuck a bit with this example(took this one from the book). Here are a description steps of what I've done till now: Step 1 - creating an empty namespace: class rec: pass IMHO that is not actually creat

Re: Classes - converting external function to class's method.

2014-12-14 Thread Thomas 'PointedEars' Lahn
Ivan Evstegneev wrote: > I have stuck a bit with this example(took this one from the book). > > Here are a description steps of what I've done till now: > > > Step 1 - creating an empty namespace: > class rec: pass IMHO that is not actually creating a namespace; it is just declaring/def

RE: Classes - converting external function to class's method.

2014-12-14 Thread Ivan Evstegneev
7;Bob' > age = 40 > def method(obj): > return obj.name.upper() Moreover, regard to the "rec.method = uppername" As I can understand, in this case Python does make some changes to the function, but they are implicit. Am I right? Sincerely, Ivan >

Re: Classes - converting external function to class's method.

2014-12-14 Thread Steven D'Aprano
Ivan Evstegneev wrote: > Hello Everyone, > > I have stuck a bit with this example(took this one from the book). The example you are working on (adding external functions as methods) is actually a bit more complicated than it seems, as you have discovered. You have this: class rec: pass rec.name