Ack, resend because pypy-dev does not set reply-to ...

On 16 July 2014 03:55, anatoly techtonik <techto...@gmail.com> wrote:
> On Tue, Jul 15, 2014 at 12:50 PM, Yichao Yu <yyc1...@gmail.com> wrote:
>> On Tue, Jul 15, 2014 at 5:05 PM, anatoly techtonik <techto...@gmail.com> 
>> wrote:
>> I guess it would be better if you can describe what you really want to do.
>
> I described. Or you need use case or user story? I think I want to link
> object instances to variable names without to print those names
> (if possible) in __repr__ and debug messages to save time on
> troubleshooting.

The most common practice is to pass some kind of debugging info to the
constructor, otherwise, setting debug info on the instance is ok, too.

my_object = SomeClass()
my_object.debug_info = 'This is the typical case'

You can also use the inspect module to grab the source line of the caller:

http://codepad.org/YvStcEMv

-- 
William Leslie

Notice:
Likely much of this email is, by the nature of copyright, covered
under copyright law.  You absolutely MAY reproduce any part of it in
accordance with the copyright law of the nation you are reading this
in.  Any attempt to DENY YOU THOSE RIGHTS would be illegal without
prior contractual agreement.
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to