Python: Quick and dirty datatypes (DTO)

后端 未结 6 1755
孤城傲影
孤城傲影 2021-02-12 10:22

Very often, I find myself coding trivial datatypes like

class Pruefer:
    def __init__(self, ident, maxNum=float(\'inf\')         


        
6条回答
  •  既然无缘
    2021-02-12 10:40

    if using Python 3.7 you can use Data Classes; Data Classes can be thought of as "mutable namedtuples with defaults"

    https://docs.python.org/3/library/dataclasses.html

    https://www.python.org/dev/peps/pep-0557/

提交回复
热议问题