On Mon, Oct 19, 2015 at 2:47 PM, Serhiy Storchaka <storch...@gmail.com> wrote:
> On 20.10.15 00:00, Guido van Rossum wrote: > >> Apart from Serhiy's detraction of the 3.5 bug report there wasn't any >> discussion in this thread. I also don't really see any specific >> questions, so maybe you don't have any. Are you just asking whether it's >> okay to merge your code? Or are you asking for more code review? >> > > I think Eric ask whether it's okay to have some incompatibility between > Python and C implementations. > > 1. Is it okay to have a difference in effect of __class__ assignment. Pure > Python and extension classes have different restrictions. For example > (tested example this time) following code works with Python implementation > in 3.4, but fails with C implementation in 3.5: > > from collections import OrderedDict > od = OrderedDict() > class D(dict): pass > > od.__class__ = D > Yes. > 2. Is it okay to use obj.__class__ in Python implementation and type(obj) > in C implementation for the sake of code simplification? Can we ignore > subtle differences? > Yes. > 3. In general, is it okay to have some incompatibility between Python and > C implementations for the sake of code simplification, and where the border > line lies? > I don't want to rule in general -- the above two look pretty clear-cut to me in this case, but even for __class__ vs. type() it's conceivable that it might be important in some other case (e.g. if it was for a proxy class :-). I think it's fine to ask here the next time there is some doubt about how far a C implementation would need to go. -- --Guido van Rossum (python.org/~guido)
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com