Re: how to get a class instance name during creation?

2008-10-04 Thread Aaron Castironpi Brady
On Oct 3, 1:46 pm, Bruno Desthuilliers [EMAIL PROTECTED] wrote: dmitrey a écrit : hi all, I have a code z = MyClass(some_args) can I somehow get info in MyClass __init__ function that user uses z as name of the variable? I.e. to have __init__ function that creates field z.name with

Re: how to get a class instance name during creation?

2008-10-04 Thread dmitrey
On Oct 3, 9:46 pm, Bruno Desthuilliers [EMAIL PROTECTED] wrote: dmitrey a écrit : hi all, I have a code z = MyClass(some_args) can I somehow get info in MyClass __init__ function that user uses z as name of the variable? I.e. to have __init__ function that creates field z.name with

Re: how to get a class instance name during creation?

2008-10-04 Thread Ben Finney
dmitrey [EMAIL PROTECTED] writes: On Oct 3, 9:46 pm, Bruno Desthuilliers [EMAIL PROTECTED] wrote: x = MyClass() y = x del x objects = [MyClass() for i in range(100)] If you can come with a meaningfull answer to what's *the* name of any of the MyClass instance(s) in both cases,

how to get a class instance name during creation?

2008-10-03 Thread dmitrey
hi all, I have a code z = MyClass(some_args) can I somehow get info in MyClass __init__ function that user uses z as name of the variable? I.e. to have __init__ function that creates field z.name with value z. Thank you in advance, D. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get a class instance name during creation?

2008-10-03 Thread Gabriel Genellina
En Fri, 03 Oct 2008 15:04:01 -0300, dmitrey [EMAIL PROTECTED] escribió: I have a code z = MyClass(some_args) can I somehow get info in MyClass __init__ function that user uses z as name of the variable? I.e. to have __init__ function that creates field z.name with value z. No. I'd just

Re: how to get a class instance name during creation?

2008-10-03 Thread Bruno Desthuilliers
dmitrey a écrit : hi all, I have a code z = MyClass(some_args) can I somehow get info in MyClass __init__ function that user uses z as name of the variable? I.e. to have __init__ function that creates field z.name with value z. This has been debated to hell and back. To make a long story