Having tries to target two of these environments at the same time I can safely say the if you have to use a database etc. you end up having to write unique code for that environment. Have you got a great way to handle this situation?
...
When I call
help(Mod.Cls.f)
(Mod is a C extension module), I get the output
Help on method_descriptor:
f(...)
doc_string
What do I need to do so that the help output is of the form
Help on method f in module Mod:
f(x, y, z)
doc_string
like it is for random.Random.shuffle, for example?
My PyMethodDef entry is currently:
...
I'm considering moving my code (around 30K LOC) from CPython to Jython, so that I could have better integration with my java code.
Is there a checklist or a guide I should look at, to help my with the migration? Does anyone have experience with doing something similar?
From reading the Jython site, most of the problems seem too obscur...
I need to evaluate a Python expression from C++. This code seems to work:
PyObject * dict = PyDict_New();
PyObject * val = PyRun_String(expression, Py_eval_input, dict, 0);
Py_DECREF(dict);
Unfortunately, it fails horribly if expression is "True" of "False" (that is, val is 0 and PyErr_Occurred() returns true). What am I doing wrong? ...
GAE has various limitations, one of which is size of biggest allocatable block of memory amounting to 1Mb (now 10 times more, but that doesn't change the question). The limitation means that one cannot put more then some number of items in list() as CPython would try to allocate contiguous memory block for element pointers. Having huge l...
I am currently in the process of making an embedded system port of the CPython 3.0 Python interpreter and I'm particularly interested in any references or documentation that provides details about the design and structure of code for Release 3.0 or even about any of the 2.x releases.
One useful document I have found so far is this infor...
How does IronPython stack up to the default Windows implementation of Python from python.org? If I am learning Python, will I be learning a subtley different language with IronPython, and what libraries would I be doing without?
Are there, alternatively, any pros to IronPython (not including .NET IL compiled classes) that would make it ...
If you invoke the cpython interpreter with the -i option, it will enter the interactive mode upon completing any commands or scripts it has been given to run. Is there a way, within a program to get the interpreter to do this even when it has not been given -i? The obvious use case is in debugging by interactively inspecting the state w...
Except for CPython, which other Python implementations are currently usable for production systems?
The questions
What are the pros and cons of the various Python implementations?
I have been trying to wrap my head around the PyPy project. So, fast-foward 5-10 years in the future what will PyPy have to offer over CPython, Jython, and...
I have a C extension module, to which I would like to add some Python utility functions. Is there a recommended way of doing this?
For example:
import my_module
my_module.super_fast_written_in_C()
my_module.written_in_Python__easy_to_maintain()
I'm primarily interested in Python 2.x.
...
What's the correct way to prevent invoking (creating an instance of) a C type from Python?
I've considered providing a tp_init that raises an exception, but as I understand it that would still allow __new__ to be called directly on the type.
A C function returns instances of this type -- that's the only way instances of this type are i...
Should it be possible for gc.get_referrers(obj) to return an empty list for an object, but the object still be accessible through a weak reference?
If so how would I start trying to identify the cause for this object not being garbage collected?
Edit: I'm not sure exactly how a code sample would help in this case - there's obviously a ...
What would you use for a brand new cross platform GUI app, CPython or IronPython ?
What about
- license / freedom
- development
- - doc
- - editors
- - tools
- libraries
- performances
- portability
What can you do best with one or the other ?
- networking
- database
- GUI
- system
- multi threading / processing...
Hello,
I have been programming in Python for a few years now and have always used CPython without thinking about it. The books and documentation I have read always refer to CPython too.
When does it make sense to use an alternative distribution (PyPy, Stackless, etc)?
Thanks!
...
I don't really get the concept of "bytecode interpreter" in the context of CPython. Can someone shed some light over the whole picture?
Does it mean that CPython will compile and execute pyc file (bytecode file?). Then what compile py file to pyc file? And how is Jython different from CPython (except they are implemented in different la...
I have a bunch of legacy code for encoding raw emails that contains a lot of print statements such as
print >>f, "Content-Type: text/plain"
This is all well and good for emails, but we're now leveraging the same code for outputting HTTP request. The problem is that the Python print statement outputs '\n' whilst HTTP requires '\r\n'.
...
I'm trying to use ctypes to extract data from internal python structures. Namely, I'm trying to read the 4 fields in an xrange:
typedef struct {
PyObject_HEAD
long start;
long step;
long len;
} rangeobject;
Is there any standard way of getting at such fields within python itself?
...
I've got a PyString* object that I would like to see the contents of. Is there any way to see the text of the PyString using Qt Creator's debugger?
PyObject *import_str = PyString_InternFromString("__import__");
If it makes a difference, Qt Creator is a front end to GDB.
...
Has IronPython gotten to a point where you can just drop it in as a replacement for CPython?
To clarify: I mean can IronPython run applications originally written for CPython (no .NET involved, of course)
...
I'm writing a Python extension in C, and I'm trying to figure out how to dynamically build and return a Python list using my extension. I know how to build a list of predetermined size using Py_BuildValue. Is there a way to create a list with Py_BuildValue then append items to that list? Is there a different, and better, alternative?
...