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, an error is stored in the error instance variable rather than being raised. This gives the user the ability to control when an error should and shouldn't 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.3.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.3-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pykon-0.3.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pykon-0.3.tar.gz
Algorithm Hash digest
SHA256 674e4be6aaf6bcc09fdaeef02ac3bb5cf2ec6f4ccf047fae33984d852383466e
MD5 9ce6ff320572372138d6b05b4f2ff358
BLAKE2b-256 33452e6f8fbec1051afc25c3547fae1791d03ed1f3f0aa60c24554cea79486ae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pykon-0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pykon-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4a7e7c1f8ae6dadfaa0f6cf36933033f524c2733709880e6da6a5d5284d05a03
MD5 b057eb0a97644b80b33cd6dbea8cb857
BLAKE2b-256 9a53d61de8aa45552a6ecda75c9030063c5a9643e690aef0c02292ad69dc1285

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