Bringing the hell of pointers to Python.
Project description
pointers.py
Bringing the hell of pointers to Python
Why would you ever need this
Examples
from pointers import _
text: str = "hello world"
ptr = _&text # creates a new pointer object
ptr <<= "world hello"
print(text) # world hello
from pointers import c_malloc as malloc, c_free as free, strcpy, printf
ptr = malloc(3)
strcpy(ptr, "hi")
printf("%s\n", ptr)
free(ptr)
Features
- Fully type safe
- Pythonic pointer API
- Bindings for the entire C standard library
- Segfaults
Why does this exist?
The main purpose of pointers.py is to simply break the rules of Python, but has some other use cases:
- Can help C/C++ developers get adjusted to Python
- Provides a nice learning environment for programmers learning how pointers work
- Makes it very easy to manipulate memory in Python
- Why not?
Installation
Linux/macOS
python3 -m pip install -U pointers.py
Windows
py -3 -m pip install -U pointers.py
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
pointers_clone.py-0.0.0.tar.gz
(63.0 kB
view details)
File details
Details for the file pointers_clone.py-0.0.0.tar.gz
.
File metadata
- Download URL: pointers_clone.py-0.0.0.tar.gz
- Upload date:
- Size: 63.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f0bc5a2c58905f99c492686fd6317e1f28bd18b22bcdfbbd810f3f731e8f13a |
|
MD5 | f2a86295f87804856a738ab3633f70e8 |
|
BLAKE2b-256 | 18e4b68d30e5a5f2a76bae4cbfa73a17f62d7e0c27c2d269133bcbab212655a8 |