Hacker News new | ask | show | jobs
by zephyrfalcon 417 days ago
You don't have to go through all the globals, you just have to get the caller's namespace, which is fairly simple. See e.g. https://stackoverflow.com/a/6618825/27426

For this reason, I think it's not true that this absolutely had to be a language feature rather than a library. A template class written in pure Python could have done the same lookup in its __init__.

1 comments

That is exactly what I ended up doing:

https://news.ycombinator.com/item?id=43752889