Python Forum
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
i wish there was
#1
i wish there was a way to have a function be able to do some big complex calculation to create a big data reference table that is exactly the same each time it is called and save it between calls to avoid repeating all that work each time it is called. i know i could save it in global space, but i'd have to code the function as a module and put some name in the caller's global space. it would have been nice for functions to each have their own way to save data between calls without polluting the caller's global namespace. i suppose i can make it be a class to do it. that's how pike does it. i better not mention that language with a one-letter name.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
You could also do a closure.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020