1,406 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
3
votes
1
answer
102
views
How to import a Haskell function in Python
I cannot fix this error. build.sh is trying to create a shared library but it fails:
~/Desktop/deepseek$ ./build.sh
Building Haskell shared library...
Loaded package environment from /home/success/....
2
votes
0
answers
175
views
What is the documented behaviour (if any) when someone imports `pkg.__init__[ as pkg]` instead of `import pkg`?
To be clear, I'm not suggesting anyone actually should import pkg.__init__ directly. This is to understand potential pitfalls if someone decides to convert a module-only distribution into a package, ...
2
votes
1
answer
77
views
Is there a way to dynamically compile Python source to bytecode using the same method as static compilation?
For the purposes of "safe" pretty-printing of lambda expressions I'd like to verify that the lambda source actually compiles to the same bytecode object as the live lambda object. (There are ...
-1
votes
0
answers
56
views
undefined symbol: PyObject_SelfIter while using CPython C API [duplicate]
I want to use CPython C API but still got this
[component_container-1] Traceback (most recent call last):
[component_container-1] File "/usr/local/lib/python3.10/dist-packages/numpy/core/...
1
vote
1
answer
89
views
In the context of Key-Sharing Dictionaries, what does sys.getsizeof measure?
If I understand correctly, Key-Sharing dictionaries make it so that if we have loads of instances of an object, we have a Shared Keys Table, and each instance then has a Value Array.
What does sys....
1
vote
0
answers
44
views
try to add keyword to python's pass_stmt like book cpython internals
I am trying book cpython internals's example: cpython internals ,you can find it at the page 72, an example that add keyword proceed to pass statement. I am using the newest version of cpython(3.14)...
0
votes
1
answer
93
views
Deferring free on a parameter
I am working with cgo, I have a parameter that's being passed in as a *C.char. Once it's been used in a function call I no longer need it, so I defer freeing it, but when I do I don't get a result ...
2
votes
0
answers
123
views
Parallel Random Number Generation in GIL-Free Python
I am doing a reinforcement learning simulation in Python that involves running many episodes and updating the weights of the agent per episode. To speed up the process, I wish to run parallel ...
0
votes
0
answers
238
views
What is the difference between the MSVC version and the CL version?
On the command line, I can see
PS C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.43.34808\bin\Hostx64\x86> ./cl /?
Microsoft (R) C/C++ Optimizing Compiler Version 19.43....
0
votes
0
answers
33
views
Get variable in a CpythonScripExecutor step in Pentaho
I’m trying of get a variable value in a CpythonScriptExecutor step in pentaho spoon but i don’t know how to do that.
I’ve tried with getVariable("My_var", "default_value") , os.getenv(...) and ${My_var} ...
0
votes
0
answers
69
views
Unpredictable behaviour when reading from stdin in python daemon thread
The python documentation says of daemon threads:
A thread can be flagged as a "daemon thread". The significance of this flag is that the entire Python program exits when only daemon threads are left.
...
0
votes
1
answer
76
views
Py_FinalizeEx does not clean up everything when rerun of import openai script
I am coding with CPython library and embedded Python into my C++ program. I use Python to run scripts and call Py_Initialize and Py_FinalizeEx per run.
It works fine until I try to import openai in ...
0
votes
1
answer
59
views
Understanding descriptor protocol for 'wrapper-descriptor' itself
I was trying to explore how would the descriptor protocol work if I were to access the object of the 'wrapper-descriptor' class itself.
So, I explored the c code in typeobject.c and found two __get__ ...
1
vote
0
answers
80
views
Multiprocessing not working with cythonize project
So for the last couple of hours I was trying to figure out a specific issue with multiprocessing when I cythonize my project and have it consist of only .pyd files. The reason I do this is because I ...
21
votes
1
answer
2k
views
How/why are {2,3,10} and {x,3,10} with x=2 ordered differently?
Sets are unordered, or rather their order is an implementation detail. I'm interested in that detail. And I saw a case that surprised me:
print({2, 3, 10})
x = 2
print({x, 3, 10})
Output (Attempt ...