Jason R. Coombs <jar...@jaraco.com> added the comment:

I've also created this alternative to option 2:

- https://github.com/jaraco/zipp/tree/bugfix/bpo-40564-mixin

This alternative approach uses a mix-in rather than subclasses, creating a new 
class on-demand. I was hoping this approach would enable just augmenting the 
instance rather than affecting `source.__class__`, but when I got to the 
implementation, I found that `source.__class__` had to be mutated regardless.

This approach does have an advantage over option 2 in that it would support 
other ZipFile subclasses for source. It has the disadvantage in that it creates 
a new subclass for every instance created.

I've thought about it a lot and while I'm not particularly happy with any of 
the approaches, I'm leaning toward option 2.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40564>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to