KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Let's say I have a class: class Thing(object): cachedBar = None def __init__(self, foo): self.foo = foo def bar(self): if not self.cachedBar: self.cachedBar = doSomeIntenseCalculation() return self.cachedBar To get bar some intense calculation, so I cache it in memory to speed things up. However, when I pickle one of these classes I don't want cachedBar to be pickled. Can I mark cachedBar as volatile / transient / not picklable?
Tags (comma-separated)
Save Edits
Cancel