Skip to content

Instantly share code, notes, and snippets.

@Tishka17
Created August 17, 2021 14:34
Show Gist options
  • Save Tishka17/0b941ab1e6ca6dda396302b3cd8fddb9 to your computer and use it in GitHub Desktop.
Save Tishka17/0b941ab1e6ca6dda396302b3cd8fddb9 to your computer and use it in GitHub Desktop.
Clooudpickle experiment
class Helper:
def do(self):
print(3)
import cloudpickle as pickle
with open("x.pkl", "rb") as f:
pickle.load(f).do()
import cloudpickle as pickle
from numpy import ndarray
from helper import Helper
class A:
def __init__(self, value):
self.value = value
self.array = ndarray([1, 2, 3])
def do(self):
print(self.value, self.array)
Helper().do()
def save(value):
a = A(value)
with open("x.pkl", "wb") as f:
return pickle.dump(a, f)
x = save(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment