Bringing the hell of pointers to Python.
Project description
pointers.py
Bringing the hell of pointers to Python
Why would you ever need this
Example
from pointers import to_ptr, Pointer, decay
a: str = '123'
b: str = 'abc'
@decay
def move(ptr_a: Pointer[str], ptr_b: Pointer[str]):
ptr_a <<= ptr_b
move(a, b)
print(a, b) # abc abc
Example with malloc
from pointers import malloc, free
memory = malloc(52)
memory <<= "abc"
print(*memory) # abc
free(memory)
print(*memory) # MemoryError
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
Running Documentation
$ git clone https://github.com/ZeroIntensity/pointers.py && cd pointers.py
$ pip install -U mkdocs
$ mkdocs serve
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.py-1.2.1.tar.gz
(8.0 kB
view hashes)
Built Distribution
Close
Hashes for pointers.py-1.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d4fe0eaf77a7eb5b0e42d0e9dcd83565ddbb131d9f897d8bdd0f622fb6c520b |
|
MD5 | 9773e9a25ffbffad5ebd8de83f16b7b1 |
|
BLAKE2b-256 | be16f619a2eea95afec9e1e676af7ae032e4fb16901dff50953eb14cff12724a |