Re: Python-list Digest, Vol 24, Issue 451
- From: Elke Hohls <elke.hohls@xxxxxxxxx>
- Date: Fri, 30 Sep 2005 12:57:10 +0200
Sorry, the last line is wrong: PySDLXMLNodeType = PyMyType ...above the correction
// == PyMyExtention.c =================================================
..
:
typedef struct {
PyObject_HEAD
long lAttribute;
} PyMyObject;static PyObject* PyMyObject_NewC (long lAttribute)
{
PyMyObject *self;
PyMyObject *type; self = new PyMyObject
self->lAttribute = lAttribute;return (PyObject*)self; }
static PyMethodDef PyMyObject_methods[] = {
{"PyMyObject_NewC", (PyCFunction)PyMyObject_NewC, METH_NOARGS,
"Create PyMyObject_NewC from C-Code"},
{NULL} /* Sentinel */
};:
static PyTypeObject PyMyType = {
PyObject_HEAD_INIT(NULL)
:
};
//===================================================================/python-list-request@xxxxxxxxxx wrote:
Send Python-list mailing list submissions to python-list@xxxxxxxxxx
To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/python-list or, via email, send a message with subject or body 'help' to python-list-request@xxxxxxxxxx
You can reach the person managing the list at python-list-owner@xxxxxxxxxx
When replying, please edit your Subject line so it is more specific than "Re: Contents of Python-list digest..."
------------------------------------------------------------------------
Today's Topics:
1. Re: Soap Question (WSDL) (Adriaan Renting) 2. Re: Will python never intend to support private, protected and public? (Gregor Horvath) 3. return (PyObject*)myPyType; ...segmentation fault! (elho) 4. Re: Self reordering list in Python (zooko)
------------------------------------------------------------------------
Subject: Re: Soap Question (WSDL) From: "Adriaan Renting" <renting@xxxxxxxxx> Date: Fri, 30 Sep 2005 11:22:36 +0200 To: <python-list@xxxxxxxxxx>
To: <python-list@xxxxxxxxxx>
You need the WSDL file if you want external probrams to be able to discover what WebService you are running, so it depends on your need if you need to use one. You can perfectly run a SOAP service without a WSDL file, using SOAPpy, only then external programs do not have a way to find out how to talk to you. A WSDL file just defines what messages, operations, urls etc. you accept/send/offer. If your external applications know how to talk to you, you can do without a WSDL file.
It contains stuff like: <wsdl:message name="sayHelloResponse1"> <wsdl:part name="sayHelloReturn" type="soapenc:string"/> </wsdl:message> ... <wsdl:operation name="sayHello"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="sayHelloRequest1"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:something.test" use="encoded"/> </wsdl:input> <wsdl:output name="sayHelloResponse1"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:something.test" use="encoded"/> </wsdl:output> </wsdl:operation>
"Armin" <akiany@xxxxxxxxx> 09/30/05 12:56 am >>>
Hey everyone, I am trying to write a web app. that connects to flickr using SOAP. The book 'Dive into python' says I need to have a WSDL file to connect, while the only useful soap related url flickr api (flickr.com/services/api) provides is the following: The SOAP Server Endpoint URL is http://www.flickr.com/services/soap/ What am I supposed to do here? Help is very much appreciated at this point. Thanks, Armin
------------------------------------------------------------------------
Subject: Re: Will python never intend to support private, protected and public? From: Gregor Horvath <g.horvath@xxxxxx> Date: Fri, 30 Sep 2005 11:31:59 +0200 To: python-list@xxxxxxxxxx
To: python-list@xxxxxxxxxx
Paul Rubin wrote:
Gregor Horvath <g.horvath@xxxxxx> writes:
Someone has a problem and tweaks a private variable as a workaround.
They should have patched the source instead.
I think they are going to do that. In the meantime our friend has a working solution otherwise he would have nothing but broken code today.
Believe it or not, not all development environments are that disorganized.
Martians? Examples?
This has nothing to do with organisation but a lot with natural influances and constraints of software development (except really simple programs)
-- Greg
------------------------------------------------------------------------
Subject: return (PyObject*)myPyType; ...segmentation fault! From: elho <eh1@xxxxxxxxx> Date: Fri, 30 Sep 2005 11:50:42 +0200 To: python-list@xxxxxxxxxx
To: python-list@xxxxxxxxxx
I called a own python type 'PyType' with a c function and returned it into my python programm - there it fault.
It is said that the object has a NULL-Pointer when I try to debug it?
Here are the importent snips from my code:
// == test.py ========================================================= . : myNewPyType = PyMyExtention.GetValue ("xxx") # printings for testing print "...back to python... test.py" print "pp\t ...PyMyType.PyMyObject:", type(tySdlXml) //===================================================================/
// == PyMyExtention.c ================================================= . : static PyObject* wrap_GetValue (PyObject* self, PyObject* args) { char* pchXXX; if (!PyArg_ParseTuple(args, "s", &pchXXX)) { return 0; }
long llong = CFunktion::CallMe(pchXXX);
// returning Python-Objekt PyObject *pyType = PyMyObject_NewC (llong); cout << "cc ..." << ((PyMyType*)pyType)->lAttribute << endl; cout << "\t ...proof object-valid pointer?" << (void*)pyType << endl; return (PyObject*)pyType; } . : //===================================================================/
// == PyMyExtention.c ================================================= . : typedef struct { PyObject_HEAD long lAttribute; } PyMyObject;
static PyObject* PyMyObject_NewC (long lAttribute) { PySDLXMLNode *self; PySDLXMLNode *type;
self = new PySDLXMLNode; self->lAttribute = lAttribute;
return (PyObject*)self; }
static PyMethodDef PyMyObject_methods[] = { {"PyMyObject_NewC", (PyCFunction)PyMyObject_NewC, METH_NOARGS, "Create PyMyObject_NewC from C-Code"}, {NULL} /* Sentinel */ };
:
static PyTypeObject PySDLXMLNodeType = { PyObject_HEAD_INIT(NULL) : }; //===================================================================/
// ::: output ::::::::::::::::::::::::::::::::::::::::::::::::::::
cc ...135603272 t ...proof object-valid pointer?: 0x8165940 ...back to python... test.py Segmentation fault
//===================================================================/
...you see: It returns to python but over there the object is something bad. So what is wrong?
------------------------------------------------------------------------
Subject: Re: Self reordering list in Python From: "zooko" <zooko@xxxxxxxxx> Date: 30 Sep 2005 02:54:08 -0700 To: python-list@xxxxxxxxxx
To: python-list@xxxxxxxxxx
I've implemented such an LRU Cache in Python. My technique was to weave a doubly-linked list into the dict, so that it is O(dict) for all LRU operations. I benchmarked it against someone's Python-list-based implementation from the ActiveState cookbook and noted that on my machine the better constant factors of the Python list win out when the list is cache contains fewer than about 16000 elements. Of course, once you exceed that cross-over point, the asymptotically worse behavior of the list-based implementation becomes a big factor. If you have more than 16000 or so elements then you really oughtn't use a list-based LRU cache.
http://zooko.com/repos/pyutil/pyutil/pyutil/cache.py
I haven't benchmarked it against Evan Podromou's heap implementation yet, but obviously inserting and removing things from a heapq heap is O(N).
You can find unit tests and benchmarking tools in the pyutil/test directory.
Regards,
Zooko
P.S. I read this list sporadically, so if you want me to read your response, please Cc: zooko@xxxxxxxxxx Thanks.
-- Kind regards / Mit freundlichen Grüßen
Elke Hohls
-------------------------------------------------------------------------- Elke Hohls delair Air Traffic Systems GmbH Lilienthalplatz 3 38108 Braunschweig Germany
Tel: +49 (0)531 215 36-210 Fax: +49 (0)531 215 36-19 E-mail: elke.hohls@xxxxxxxxx http://www.delair.de .
- Prev by Date: Re: Problem with long strings in the Boost.Python getting_started2 sample ?
- Next by Date: Re: Will python never intend to support private, protected and public?
- Previous by thread: Re: Hello gnome-terminal
- Next by thread: Compile fails on x86_64
- Index(es):
Relevant Pages
|