instance name

max(01)* max2 at fisso.casa
Sat Apr 2 11:05:10 EST 2005


Andrew Koenig wrote:
> "max(01)*" <max2 at fisso.casa> wrote in message 
> news:99z3e.1157607$35.42889387 at news4.tin.it...
> 
> 
>>is there a way to define a class method which prints the instance name?
> 
> 
> The term "the instance name" is misleading, because it assumes, without 
> saying so explicitly, that every instance has a unique name.
> 
> In fact, there is no reason that an instance needs to have a name at all, or 
> that it should have only one.
> 
> You gave this example:
> 
>     instance_1 = class_1()
>     instance_1.myName()
> 
> but what if I did this instead?
> 
>     class_1().myName()
> 
> Or this?
> 
>     instance_1 = class_1()
>     instance_2 = instance_1
>     instance_2.myName()
> 
> 

excellent points.

i'll get back with proper questions afterwards.

thanks

macs



More information about the Python-list mailing list