Skip to main content

This project makes saving/loading procedure easier for classes with inheritance.

Project description


This small class is made for ease and standardize saving and loading procedures in classes with inheritance in the case when pickle is not applicable.


After you declare a new root class with name ClassName of inheritance you should write following string


WARNING: do not define __init__ functions with more than one parameter in root class or its descendants.

After that type:


You can leave the parameter of registerClass function empty in this case string would be generated automatically.

WARNING: do not use equal string parameters in descendants of one root class!

Also, each class should have two functions defined:

def saveThisObjectDataOnly_(self, folder):
def loadThisObjectDataOnly_(self, folder):

This functions should save and load fields of class where they defined, not parent classes fields.


pip install serialazableClass


from serializableClass import SerializableClass

class rootClass(SerializableClass):
def saveThisObjectDataOnly_(self, folder):
print(“save root”)
def loadThisObjectDataOnly_(self, folder):
print(“load root”)

rootClass.initNewRootOfInheritance() rootClass.registerClass(“root”)

class d1(rootClass):
def saveThisObjectDataOnly_(self, folder):
print(“save d1”)
def loadThisObjectDataOnly_(self, folder):
print(“load d1”)


class d2(rootClass):
def saveThisObjectDataOnly_(self, folder):
print(“save d2”)
def loadThisObjectDataOnly_(self, folder):
print(“load d2”)


class d3(d1, d2):
def saveThisObjectDataOnly_(self, folder):
print(“save d3”)
def loadThisObjectDataOnly_(self, folder):
print(“load d3”)


obj = d3()“test”)

#output is #save d3 #save d1 #save root #save d2


#output is #load root #load d1 #load d2 #load d3

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for serializableClass, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size serializableClass-1.0.2-py3-none-any.whl (4.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size serializableClass-1.0.2.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page