cloudpipe / cloudpipe/cloudpickle

Support for pickling functions within a class defined outside of __main__?

Aperta
#175 6 commenti 2 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Python
Stelle
1.9k
Fork
195
Merge medio
1g 10h
PR unite (30g)
1

Descrizione

Cloudpickle's ability to serialize instantiated classes and their member functions is a huge advantage over cloudpickle alternatives. Unfortunately, this feature seems limited heavily to the check for `instantiated_class.__module__ == '__main__'`.

One hacky solution is to set `__module__` in the class definition:
```
class SomeFunClass(object):
__module__ = '__main__'

# Rest of the class definition
```

But this could cause problems with any code that relies on a proper value for `__module__`. Is there another solution I'm not seeing?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.