ZeroIntensity / pointers.py

Bringing the hell of pointers to Python.
https://pointers.zintensity.dev/
MIT License
917 stars 12 forks source link

Why #1

Open TKIPisalegacycipher opened 2 years ago

TKIPisalegacycipher commented 2 years ago

Would you do this

ZeroIntensity commented 2 years ago

because why not?

JesseTG commented 2 years ago

There isn't enough pain in this world.

prkhrv commented 2 years ago

WHY?? I switched to python to avoid dealing with pointers.

ZeroIntensity commented 2 years ago
from pointers import to_ptr

to_ptr(19) <<= 21
print(9 + 10) # 21
JesseTG commented 2 years ago

I'm sure there's some kind of regulatory agency for programmers, and as soon as I figure out what it is I'm going to report you to it.

Delation commented 2 years ago
from pointers import to_ptr

to_ptr(19) <<= 21
print(9 + 10) # 21

I understand why now.

ldo commented 2 years ago

ctypes is cool, though. I have used it a lot.

Tip: I note with approval you have avoided doing “from ctypes import *” as per the documentation examples. However, I find continually typing “ctypes.this” and “ctypes.that” to be quite tedious. So I shorten it using “import ctypes as ct” instead. Then references become “ct.this” and “ct.that”.

ZeroIntensity commented 2 years ago

my ide was saying that doing from ctypes import * was illegal as wildcard imports from library wasn't allowed, so i didn't bother trying to hassle with flake8 or mypy which would complain about it later

ldo commented 2 years ago

It’s not illegal, but minimizing namespace pollution is a good idea.

NewbCooder commented 2 years ago

The world cannot be at peace!! Hence we have pointers😂😂

DexterAntonio commented 2 years ago

Someone wrote a medium article describing how great this package is for writing faster code 😟. I'm sure this is being used in production somewhere.

ZeroIntensity commented 2 years ago

havent tried any benchmarks, but i doubt that this makes things any faster (other than c bindings, but that still has a lot of abstraction going on)

tommyvo commented 2 years ago

Could this be used to implement linked lists?

ZeroIntensity commented 2 years ago

you can implement linked lists just fine without this