`final` keyword equivalent for variables in Python?

后端 未结 11 1943
忘了有多久
忘了有多久 2021-01-30 20:17

I couldn\'t find documentation on an equivalent of Java\'s final in Python, is there such a thing?

I\'m creating a snapshot of an object (used for restorati

11条回答
  •  后悔当初
    2021-01-30 20:39

    http://code.activestate.com/recipes/576527/ defines a freeze function, although it doesn't work perfectly.

    I would consider just leaving it mutable though.

提交回复
热议问题