Skip to main content

A module allowing for constant and publicly immutable data.

Project description

                    ██████╗ ██╗   ██╗██╗  ██╗ ██████╗ ███╗   ██╗
                    ██╔══██╗╚██╗ ██╔╝██║ ██╔╝██╔═══██╗████╗  ██║
                    ██████╔╝ ╚████╔╝ █████╔╝ ██║   ██║██╔██╗ ██║
                    ██╔═══╝   ╚██╔╝  ██╔═██╗ ██║   ██║██║╚██╗██║
                    ██║        ██║   ██║  ██╗╚██████╔╝██║ ╚████║
                    ╚═╝        ╚═╝   ╚═╝  ╚═╝ ╚═════╝ ╚═╝  ╚═══╝

Pykon is a way to allow constant and publicly immutable data.

Though, data can be modified its type cannot.

With Pykon, errors are returned rather than being raised

giving the user the ability to control when an error should be raised.

Example

from pykon import Pykon
from typing import Union

mylist: Pykon = Pykon(list, [1,2,3,4])

try:
    print(mylist.data)
except Pykon.PykonError:
    raise mylist.error

# Using an if statement
#
# if hasattr(mylist, "data"):
#    print(mylist.data)
# else:
#    raise mylist.error


# Return a PykonError from a function
#
# def test() -> Union[None, Pykon.PykonError]:
#     constantInt: Pykon = Pykon(int, 20)
#     if hasattr(constantInt, "data"):
#         print(constantInt.data)
#         return None
#     else:
#         return constantInt.error

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

pykon-0.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

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

pykon-0.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file pykon-0.1.tar.gz.

File metadata

  • Download URL: pykon-0.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for pykon-0.1.tar.gz
Algorithm Hash digest
SHA256 b1d4a5ecfa8a03585d2d7b77523a90ceeb9e9fbde623842425b9b40345c275d1
MD5 bf3a6849aa97620ff4127e3a6e95a866
BLAKE2b-256 7bf1f0ca70b2748dbed3db9239032d91f41d39a80f8918723948b5abf51d8137

See more details on using hashes here.

File details

Details for the file pykon-0.1-py3-none-any.whl.

File metadata

  • Download URL: pykon-0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for pykon-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3336a55dd836d9b207ded5cae736af126adaf223d85c0748505015fe183e9369
MD5 2227eaab9e535dbead76e95569207e30
BLAKE2b-256 b668e948b66d3191d8f3f25caaf63bd39fb23ecf4b1d484acfec2d8e236fb235

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