No project description provided
Project description
struuuctify
Installation
pip install struuuctify
Rust like struct for python
Define a new struct:
from structify import struct, impl
@struct
class Point:
x: float
y: float
And add method implementation on that struct
@impl
def add(
self: Point,
) -> float:
return self.x + self.y
You can now instanciate the struct and call the method as if it was defined in the class:
p = Point(1, 2)
p.add()
>> 3
Limitation
This project is more of a gimmick-y pattern and experimentation around rust-like struct in Python !
- Mypy and type checkers will not be aware of the method declared on your struct as they are added at runtime.
- If you define methods on the same struct from different locations, you could end up having clash
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 Distribution
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 struuuctify-0.0.4.tar.gz.
File metadata
- Download URL: struuuctify-0.0.4.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2257fece78d0dbf69dbd54caf19051f579e664b8df861f854a638677530745ae
|
|
| MD5 |
7994cead313e118cb3daf8b98bcacfbd
|
|
| BLAKE2b-256 |
077fa1de20bba5013ca0c61b237d8128f4451935f80670cc502d2bb26735e8f4
|
File details
Details for the file struuuctify-0.0.4-py3-none-any.whl.
File metadata
- Download URL: struuuctify-0.0.4-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1570766d958240a83d1f20fd9124cb1816053433c222eb1edc1219d592433f4
|
|
| MD5 |
460dbcfeaa6bca34751f877d27be7752
|
|
| BLAKE2b-256 |
49caa4650d414bca893cfff92cf55c9b4aa4f365352b3b18c0cf8100d0d2f13d
|