Skip to main content

Bringing the hell of pointers to Python.

Project description

pointers.py

Tests

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 bindings

from pointers import fopen, fprintf, fclose

file = fopen("/dev/null", "w")
fprintf(file, "hello world")
fclose(file)

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

Running Documentation

$ git clone https://github.com/ZeroIntensity/pointers.py && cd pointers.py
$ pip install -U mkdocs
$ mkdocs serve

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

pointers.py-1.3.5.tar.gz (17.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page