Type hinting for any object

后端 未结 9 1638
梦毁少年i
梦毁少年i 2020-12-14 05:43

I\'ve been working on code that\'s intended to be used with objects, without really caring what the kind of object is. I wanted to type hint that the method being written ex

9条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-14 06:19

    There is no base class that all objects extend from. You should just remove the typehint and document the expected type in the @param annotation.

提交回复
热议问题