> In the example above, self.b is assigned the value of b, not Enum(b). And >>>> even if you called-- or gave the option to call-- func(*args, **kwargs) >>>> first, autoassign still wouldn't know that you want to modify the supplied >>>> parameter value. >>>> >>> >>> But you could just write `self.b = MyEnum(b)`, and it would overwrite >>> the auto-assigned `self.b = b`. >>> >> >> I.... didn't think of that. In that case, though, you're assigning self.b >> twice. If it is a descriptor, that might not be desirable and result in all >> kinds of side effects. >> > > 1. The combination of a non-idempotent descriptor and wanting to customise > the input in `__init__` seems very rare. Since this is a convenience, I > think it's fine to not support every use case. > 2. The problem can be solved by putting the customisation in the > descriptor, which is probably a good idea anyway. > 3. A user would have to be particularly careless to do this by mistake and > cause actual damage. It should be obvious from both a brief description of > the decorator and some basic experimentation that it assigns to > descriptors. A simple test of the user's actual code would also likely > reveal this. >
Good arguments. I'm not-not convinced.
_______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/WBOXPHFAG2HERLAL6RTAFKG7QHW24XYA/ Code of Conduct: http://python.org/psf/codeofconduct/
