Message239622
I'm not sure how you can have both, those two seem opposite to me:
- if 'from_bytes' returns the same type as the class it is called on then
the instantiation of the result object should go through its constructor
(patch proposed)
- if the subclass should override base class behaviour then there is no
reason for Enum.from_bytes to return the same type as the class it is
called on, and therefore it should be made a classmethod.
2015-03-30 18:02 GMT+02:00 Ethan Furman <report@bugs.python.org>:
>
> Ethan Furman added the comment:
>
> 'from_bytes' is a classmethod. As such, it should return the same type as
> the class it is called on. If that wasn't the intent it would be a
> staticmethod instead.
>
> It is the responsibility of the subclass to override base class behavior,
> not the other way around.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue23640>
> _______________________________________
> |
|
Date |
User |
Action |
Args |
2015-03-30 16:35:05 | bru | set | recipients:
+ bru, barry, eli.bendersky, ethan.furman, serhiy.storchaka |
2015-03-30 16:35:05 | bru | link | issue23640 messages |
2015-03-30 16:35:05 | bru | create | |
|