Immutable-Python-type
package for make immutable all types in Python
Support types and replaced by:
- int =
Int_()
- float =
Float_()
- str =
Str_()
- bool =
Bool_()
- set =
Set_()
- tuple =
Tuple_()
- list =
List_()
- dict =
Dict_()
Examples
from immutableType import Bool_, Int_
immutable_bool = Bool_(True)
immutable_int = Int_(1)
immutable_bool.bool_ = 1234
immutable_bool.bool_ = False
print(immutable_int == immutable_bool)
"""
Immutable boolean consider True = 1 and False = 0
"""
Int_(integer: int)
from immutableType import Int_
my_int = Int_(1234)
my_int.int_
Int_() have methods :
__str__ : return string with the integer value
__int__ : return the integer value
__bool__ : return True if the value == 1 else False
__eq__, __and__, __or__, __iand, __ior__ : basic comparaison
__add__, __sub__, __iadd__, __isub__, __mul__, __imul__, __truediv__, __itruediv__, __pow__, __ipow__ : basic operation (only int value are accepted for operation. The result of a division is always an integer. Use Float_ class for more precision.)
redaction in progress...