Content deleted Content added
m →Python: Update Python example code from deprecated Python 2 to Python 3 |
|||
Line 292:
=== Python ===
In [[Python (programming language)|Python]], some built-in types (numbers, booleans, strings, tuples, frozensets) are immutable, but custom classes are generally mutable. To simulate immutability in a class, one
<syntaxhighlight lang="python">
class ImmutablePoint
"""An immutable class with two attributes 'x' and 'y'."""
Line 308:
# We can no longer use self.value = value to store the instance data
# so we must explicitly call the superclass
super(
super(
</syntaxhighlight>
|