Bynd is a way of introducing static typing to Python.
Project description
██████╗ ██╗ ██╗███╗ ██╗██████╗
██╔══██╗╚██╗ ██╔╝████╗ ██║██╔══██╗
██████╔╝ ╚████╔╝ ██╔██╗ ██║██║ ██║
██╔══██╗ ╚██╔╝ ██║╚██╗██║██║ ██║
██████╔╝ ██║ ██║ ╚████║██████╔╝
╚═════╝ ╚═╝ ╚═╝ ╚═══╝╚═════╝
A module which allows binding data to one or more types.
Bynd's intended use, is to be assigned to a variable.
Which, in this case, the variable can still be used
exactly the same way just by accessing the 'data'
class attribute. Since 'Bynd' "binds" the data to
one or more types, the data cannot be modified
causing it to become static and forces the programmer
to create mutable references which can be modified.
The benefits of using Bynd are:
Runtime type checking
Constant data
Ability to access the bound data and its types with the '__info__' class attribute or just the data itself from the variable in which it is stored by accessing the 'data' class attribute
Bynd: Basic Usage
# filename: Bynd_test.py
from Bynd.bynd import Bynd
# Instantiates a Bynd object and binds the data "some string" to the type 'str'
my_variable = Bynd("some string", {str}) # the data can't be changed
# The above code will raise a 'ByndError' if the data is not of type 'str'
# To access the data, we can use the dot '.' operator.
print("my_variable.data: ", my_variable.data)
# The 'data' and 'types' can be accessed using the '__info__' class attribute.
print("my_variable.info: ", my_variable.__info__)
# Output:
# my_variable.data: "some string"
# my_varaible.__info__: {"some string": {<class 'str'>}}
NOTE:
Bynd, by default, performs recursive type checking. What that means is, for any collection type (list, tuple, set, etc.) it encounters, collection elements types are checked against the type set. All types need to be known or assumed when using 'Bynd'. Bynd does not make use of type hints in any way and it introduces strict typing (in a way) to Python by striping some of its flexibility.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bynd-1.5-py3-none-any.whl.
File metadata
- Download URL: bynd-1.5-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b46b54ead027950ea64c530c1ade82f6b7fa515e2f9bcddea63bd0fc1cbc796a
|
|
| MD5 |
217d5606798c1827d48370b393960b7f
|
|
| BLAKE2b-256 |
57e3d70f8810e93c1ad7842303912c086ade4294bfea9e1601a3456a5a3d3ade
|