[Python-ideas] ABC: what about the method arguments ? (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Thu Sep 23 17:39:55 CEST 2010
- Previous message: [Python-ideas] ABC: what about the method arguments ?
- Next message: [Python-ideas] ABC: what about the method arguments ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 23 Sep 2010 16:37:21 +0200 Tarek Ziadé <ziade.tarek at gmail.com> wrote:
The problem is that the implemented method could have a different list of arguments and will eventually fail. Using inspect, we could check in subclasshook that the arguments defined are the same than the ones defined in the abstractmethod.-- the name and the ordering.
I don't think we should steer in the type checking direction. After all, the Python philosophy of dynamicity (dynamism?) is articulated around the idea that checking types "ahead of time" is useless. IMO, ABCs should be used more as a convention for documenting what capabilities a class claims to expose, than for type checking.
(also, you'll have a hard time checking methods with *args or **kwargs parameters)
Regards
Antoine.
- Previous message: [Python-ideas] ABC: what about the method arguments ?
- Next message: [Python-ideas] ABC: what about the method arguments ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]