entanglement.py: New tool for calling C++ symbols directly from Python using the C++ABI

2025-08-22 Thread Adrian Johnston via Python-list
Hello, I recently hacked together a script called entanglement.py that uses libclang to parse C++ headers and generate a Python wrapper that can call the C++ symbols in a .so directly. The Itanium C++ ABI is easy enough to call from ctypes with 1 exception. Returning a class by value from C++ resu

Re: not understanding the result of functools.reduce

2025-08-22 Thread Ethan Carter
r...@zedat.fu-berlin.de (Stefan Ram) writes: > Ethan Carter wrote or quoted: >>## The question is how to write such an operator. I wrote this one: >>def op(x, b): >> return isinstance(x, int) or b > > The main snag with your op function and how you're using > reduce is the switch-up in the

not understanding the result of functools.reduce

2025-08-22 Thread Ethan Carter
# -*- mode: python; python-indent-offset: 2 -*- from functools import reduce ## I'm puzzle with this result of reduce. Can you spot where my mind ## is going wrong? ## ## The problem I want to solve with /reduce/ (merely for the sake of ## exercise) is to collapse a list of lists to a list of b