Re: Does the Python/C interface support Queue objects?

2005-05-05 Thread Fredrik Lundh
"[EMAIL PROTECTED]" wrote:

> A little background.  I made a C dll that sets up a thread for
> collecting data from an NI data aquisition card.  The thread builds a
> list and passes the list to to python via a callback, then python puts
> them in the Queue.   I would prefer to put the data in the Queue from
> the C thread for efficiency,  and then monitor the Queue from python.

the Queue type is implemented in Python, so you won't gain much by
skipping the callback.

but if you insist, you can use the abstract API to manipulate the queue
object:

http://docs.python.org/api/object.html

res = PyObject_CallMethod(queue, "put", "O", object);
... check error status ...
Py_DECREF(res);





-- 
http://mail.python.org/mailman/listinfo/python-list


Does the Python/C interface support Queue objects?

2005-05-05 Thread scott . manton
I'm a new user of the Python C interface.  I would like to know if it
is possible  to put items on a standard python Queue  object in C, and
pop them from Python.  Does the Python/C interface support Queue
objects?

A little background.  I made a C dll that sets up a thread for
collecting data from an NI data aquisition card.  The thread builds a
list and passes the list to to python via a callback, then python puts
them in the Queue.   I would prefer to put the data in the Queue from
the C thread for efficiency,  and then monitor the Queue from python.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Interface support?

2005-03-18 Thread Ville Vainio
> "Michael" == Michael Spencer <[EMAIL PROTECTED]> writes:

Michael> Steve wrote:

>> Is it possible to design interfaces that classes must implement
>> in Python?

Michael> PyProtocols: http://peak.telecommunity.com/PyProtocols.html,

This (PyProtocols) seems to be the one with biggest momentum at the
time being, so if you can't be bothered to perform an independent and
balanced evaluation, go for PyProtocols :-).

-- 
Ville Vainio   http://tinyurl.com/2prnb
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Interface support?

2005-03-17 Thread Michael Spencer
Steve wrote:
Is it possible to design interfaces that classes must implement in 
Python? 
There are some well-known 'independent' implementations of interfaces:
Zope Interfaces :http://www.zope.org/Wikis/Interfaces/FrontPage
-  a separable component of the much larger app server
Twisted Interfaces: see http://twistedmatrix.com/
PyProtocols: http://peak.telecommunity.com/PyProtocols.html, whose 
author is one of the protagonists in the PEP246 saga

There are also several possible light-weight roll-your-own solutions
One common idiom is an abstract base class:
class SomeInterface(object):
   def someMethod(self, argspec):
# Should never get here, because the implementation overrides this 
method
raise NotImplmentedError
but the compiler doesn't pay any special attention to these classes so failure 
to implement the interface is detected at runtime

If it's not, is this functionality planned at all for the future?

Python Enhancement Proposals 245, and 246 http://www.python.org/peps/ discuss an 
interface syntax and the related topic of object adaptation.  These are both 
current discussions among the Python developers with no decision on whether/when 
 to introduce either as far as I know.  Observer the fray at: 
http://mail.python.org/pipermail/python-dev/

Guido Van Rossum (Python creator and BDFL) recently blogged about "Optional 
Static Type Checking" http://www.artima.com/weblogs/viewpost.jsp?thread=89161
as part of long-range planning for a future Python 3000 (some years in the future)

HTH
Michael
--
http://mail.python.org/mailman/listinfo/python-list


Re: Interface support?

2005-03-17 Thread Michele Simionato
Now they use the same interface package. For the other
questions: google is your friend. (try "zope interfaces"
then "twisted interfaces").

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Interface support?

2005-03-17 Thread Steve
Michele Simionato wrote:
Twisted and Zope already use interfaces. You can download
the interface package and use it in you project.
Thanks for the response. I'm completely new to Python, where exactly 
would I go to find these interface packages(Python site, or Twisted/Zope 
sites)? Is it the same interface package for both, or are they 
different? If different, is one better than the other?

Thanks,
Steve
--
http://mail.python.org/mailman/listinfo/python-list


Re: Interface support?

2005-03-17 Thread Michele Simionato
Twisted and Zope already use interfaces. You can download
the interface package and use it in you project.


   Michele Simionato

-- 
http://mail.python.org/mailman/listinfo/python-list


Interface support?

2005-03-17 Thread Steve
Is it possible to design interfaces that classes must implement in 
Python? If it's not, is this functionality planned at all for the future?

Thanks,
Steve
--
http://mail.python.org/mailman/listinfo/python-list