Any comment on the proposed changes? Well if no-one objects, I would like to move forward and implement these changes:
- Deprecate __reduce_ex__ and copyreg.pickle in 2.6 and 3.0 (with a planned removal in 3.1). - Make __reduce__ raise a TypeError on the condition previously described in 3.0. -- Alexandre On Sun, Jun 8, 2008 at 6:26 PM, Alexandre Vassalotti <[EMAIL PROTECTED]> wrote: > Hello all, > > I would like to propose to following simplifications to the copy > protocol (a.k.a the __reduce__ method): > > - Remove the type.__reduce_ex__ method and define __reduce__ method > to take a single optional integer argument that is the pickle protocol > version to use. And since this already the current behavior of > __reduce__, no change is required. > - Deprecate copyreg.pickle in favor of the __getnewargs__ special > method. They both solve the exact same problem, but __getnewargs__ > does it in a simpler and more robust manner. > - Make __reduce__ raise a TypeError if the class of an instance > derives from one or more extension type (object, list and dict > excluded) and neither __getnewargs__ nor __getstate__ is defined. > > I believe that these changes will make it easier for developers to > write classes that supports the copy protocol, which is already quite > complex in addition of being poorly documented. Evidently, I will > provide the patches and write the documentation for these changes. > > Cheers, > -- Alexandre > _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com