2014-11-28 13:00 GMT+08:00 Chris Angelico <ros...@gmail.com>: > On Fri, Nov 28, 2014 at 2:04 PM, Shiyao Ma <i...@introo.me> wrote: >> What if it's in the local namespace of a function or method? IDK, try >> to get that thing first. > Sure enough. I will even avoid using "id" as it's dependent on CPython implementation. :)
> What if it's in multiple namespaces? What if it's not in any at all? > Your solution is not going to work in the general case, AND it's a bad > idea. > Please don't do this in any code that I'll ever have to > maintain. No way. You will never get my project code in such a form. I am way more peculiar about readability and robustness than most of my other ppl. The point is, the bpate is just for demonstration to show there is a *possible* way to find the name even you didn't specify it at first hand. -- 吾輩は猫である。ホームーページはhttp://introo.me。 -- https://mail.python.org/mailman/listinfo/python-list