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])

if hasattr(mylist, "error"):
    raise mylist.error
else:
    print(mylist.data)


# Using a try except block
#
# try:
#    print(mylist.data)
# except AttributeError:
#    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.2.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.2-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pykon-0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 ef3c2609b8dd5d5a101df77bdb12c6191006fcfbc6f55fec1297f3ddc0616b38
MD5 29bb0bceb07115f34987a06dba2237e6
BLAKE2b-256 d64b80a41e257aceb6fd434a557bf0792bb73d40a751deeed88d1d8bcaa05691

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pykon-0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 466bbd0e8ef921750e607a8b59b858969dfac03d13a7254157a37be991c51365
MD5 637b2260aed8ef164884955a09082d38
BLAKE2b-256 35badc4a8ca9132c32f296a58ce5284ae66eafce4179710b7725540f6b22330b

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