trouble with the C API
Bernhard Herzog
herzog at online.de
Mon Aug 21 13:48:07 EDT 2000
More information about the Python-list mailing list
Mon Aug 21 13:48:07 EDT 2000
- Previous message (by thread): File Upload Problem
- Next message (by thread): trouble with the C API
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Stefan Seefeld <seefelds at magellan.umontreal.ca> writes: > I'm writing a C module for a python tool I'm working > on and I'm having trouble with the C API. What is the > distinction between the PyDict_xxx abd the PyMapping_xxx > functions ? I defined (in python) my own type containing > the methods __setitem__, haskey, etc. to make it 'dictionary > conformant'. Now I want to access and modify the content. > The key is a list of strings (which I map to a tuple on the > fly). There is no PyMapping_GetItem call for keys other than > strings. (but the equivalent dict function exists !). You could use PyObject_GetItem. > Unfortunately, it appears I can't mix Dict and Mapping functions > since they operate on different slices of the object. At least > I can't access an item via a dict call which I set via a mapping > call etc.... The PyDict functions only work with dictionary objects. The PyMapping funtions are more general and work with all objects that support the mapping protocol at the C-level. -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/
- Previous message (by thread): File Upload Problem
- Next message (by thread): trouble with the C API
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list