1

I want to do exactly what OP is trying to do here. That post is from 2013. Is this still the same in 2018 in Python 3.6.3? Or is there a better way to do this now?

  • What is wrong with existing answers? What is "better" in your case? Related meta discussion: [How to get a new answer for an old question](https://meta.stackexchange.com/q/288328/137096) – jfs Feb 06 '18 at 17:52
  • Nothing is wrong. The question is whether having the same question today for Python 3 gives the same answers... –  Feb 06 '18 at 17:59
  • unless the question is closed, you can post new "better" answers anytime. There is even [Necromancer badge](https://stackoverflow.com/help/badges/17/necromancer) – jfs Feb 06 '18 at 18:02
  • You should've at least try that method first. It won't hurt if you test it in your own console or IDE rather then asking for it directly – Gahan Feb 06 '18 at 18:37
  • What are you talking about? I've tried the accepted answer, it works, but doesn't look to pythonic. Also, @jfs, I don't have a better answer I could give over there... The question is, is there a different and better way to solve this problem in 3.x... –  Feb 06 '18 at 19:23
  • "nothing is wrong" and "doesn't look to pythonic" seems to contradict each other. [edit] your question and describe what is wrong [in your opinion] with the answers. What answer would you consider useful in your particular case. btw, what is unpythonic about using function attributes? Functions are objects in Python. The language uses many attributes itself e.g., `f.__name__`, `f.__annotations__`, `f.__defaults__`. If you create a [closure](https://stackoverflow.com/q/13857/4279) to store the data; it is still stored in the function attributes (`f.__closure__[i].cell_contents`) class, module – jfs Feb 06 '18 at 20:07

0 Answers0