GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ZeroIntensity/pointers.py: Bringing the hell of pointers to Python.

BranchesTags
Open more actions menu

Latest commit

 

History

215 Commits
215 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
docs
docs
 
 
examples
examples
 
 
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
compile_flags.txt
compile_flags.txt
 
 
gen.py
gen.py
 
 
hatch_build.py
hatch_build.py
 
 
mkdocs.yml
mkdocs.yml
 
 
netlify.toml
netlify.toml
 
 
pyproject.toml
pyproject.toml
 
 
requirements.txt
requirements.txt
 
 
requirements_dev.txt
requirements_dev.txt
 
 
runtime.txt
runtime.txt
 
 
setup.py
setup.py
 
 

Repository files navigation

pointers.py

Tests

Bringing the hell of pointers to Python

Why would you ever need this

  • Documentation
  • Source
  • PyPI

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, c_free, strcpy, printf

ptr = c_malloc(3)
strcpy(ptr, "hi")
printf("%s\n", ptr)  # hi
c_free(ptr)
from pointers import malloc, free

my_str = malloc(103)
my_str <<= "hi"
second_str = my_str[51]
second_str <<= "bye"
print(*my_str, *second_str)  # hi bye
free(my_str)

Features

  • Fully type safe
  • Pythonic pointer API
  • Bindings for the entire C standard library and CPython ABI
  • 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

About

Bringing the hell of pointers to Python.

pointers.zintensity.dev/

Topics

memorymemory-allocationmemory-managementpointerspythonpython-pointers

Resources

Readme
MIT license

Contributing

Contributing
Activity

Stars

938 stars

Watchers

6 watching

Forks

11 forks
Report repository

Releases

Sponsor this project

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.