Generics/templates in python?

前端 未结 10 1485
深忆病人
深忆病人 2020-12-22 19:16

How does python handle generic/template type scenarios? Say I want to create an external file \"BinaryTree.py\" and have it handle binary trees, but for any data type.

10条回答
  •  青春惊慌失措
    2020-12-22 19:34

    Fortunately there has been some efforts for the generic programming in python . There is a library : generic

    Here is the documentation for it: http://generic.readthedocs.org/en/latest/

    It hasn't progress over years , but you can have a rough idea how to use & make your own library.

    Cheers

提交回复
热议问题