Python: Quick and dirty datatypes (DTO)

后端 未结 6 1865
后悔当初
后悔当初 2021-02-12 10:21

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/

提交回复
热议问题