[Python-3000] Simplifying the copy protocol

Alexandre Vassalotti alexandre at peadrop.com
Fri Jun 20 00:52:45 CEST 2008


On Thu, Jun 19, 2008 at 6:11 PM, Guido van Rossum <guido at python.org> wrote:
> I haven't had the time to look into this, but it sounds unintuitive to
> drop __reduce_ex__ which is supposed to be the "extended" IOW "newer"
> version of the API compared to __reduce__ which was deemed to be
> missing something.
>

Well, the idea was not to drop __reduce_ex__, but to rename it to
__reduce__.  That said, I just realized that might not be a good idea
after all. Since __reduce_ex__ as __reduce__ would mean that
__reduce__ would need to always be called with the extra protocol
argument, thus breaking code that defines __reduce__ as a method
without argument.  I first thought that by making the argument
"optional" would avoid this, but that obviously won't work.

So, forget that idea.

-- Alexandre


More information about the Python-3000 mailing list