Lets say I have a class. It holds other classes in it.
ex

class Test:
    def__init__(self, name):
        self.name = name
    def getname(self):
        print(self.name)

class Holder:
    def __init__(self, tests):
        self.tests = tests
    def getnames(self):
        for i in self.tests:
            print( i.getname())

so lets say I pickle an instance of Holder with 3 instances of Test in it. If I unpickle later, are the instances of Test pickled too? And can I put them back into variables after?

Recommended Answers

All 2 Replies

Pickle does work recursively, so 'Yes'.

Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.