Skip to main content

A immutable type for Python

Project description

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) # init immutable boolean
immutable_int = Int_(1) # init immutable integer

immutable_bool.bool_ = 1234 # raise an error
immutable_bool.bool_ = False # good

print(immutable_int == immutable_bool) # print False
"""
Immutable boolean consider True = 1 and False = 0
"""

Int_(integer: int)

from immutableType import Int_

my_int = Int_(1234) # init immutable integer
my_int.int_ # property to get the value in 'int' type

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...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

immutable_python_type-1.2.3.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

immutable_python_type-1.2.3-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file immutable_python_type-1.2.3.tar.gz.

File metadata

  • Download URL: immutable_python_type-1.2.3.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for immutable_python_type-1.2.3.tar.gz
Algorithm Hash digest
SHA256 c4836a28fcb5c97a57aa1c28fec87d715f08684e25954f2c9df3bd081ab6f515
MD5 0a76414c8c1c2dad683860ca53d19959
BLAKE2b-256 5234db0316fae7585f9a54ce6c504b3d2fc95ae42192081b0ffaf6bc4440a948

See more details on using hashes here.

File details

Details for the file immutable_python_type-1.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for immutable_python_type-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bec90a8b015f0619036dd336073edf26a98a3691d25dd67d4698cf3b1cc41652
MD5 a477d9b1f3ec1f0ea20badc9f3328746
BLAKE2b-256 1abcaf572b5bde48d9011a35d6e14da6e2d4fe8340f8c1ae52210b1a7b2e17ac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page