Re: Slices when extending python with C++

2011-12-28 Thread rozelak
Great, it's working! Thank you very much, Robert! Dan T. - PŮVODNÍ ZPRÁVA - Od: "Robert Kern" Komu: python-list@python.org Předmět: Re: Slices when extending python with C++ Datum: 28.12.2011 - 14:18:36 > On 12/28/11 1:01 PM, roze...@volny.cz wrote: > > Dear R

Re: Slices when extending python with C++

2011-12-28 Thread Robert Kern
On 12/28/11 1:01 PM, roze...@volny.cz wrote: Dear Robert, thank you very much for your answer. I understand what you mean and I have looked at slice object and C-api methods it provides. It should be easy to implement it. The only question is how exactly yo implement the general getter, since s

Re: Slices when extending python with C++

2011-12-28 Thread rozelak
another way? Thank you very much again. Regards, Dan - PŮVODNÍ ZPRÁVA - Od: "Robert Kern" Komu: python-list@python.org Předmět: Re: Slices when extending python with C++ Datum: 28.12.2011 - 10:24:42 > On 12/27/11 11:02 PM, roze...@volny.cz wrote: > > Hallo, > &g

Re: Slices when extending python with C++

2011-12-28 Thread Robert Kern
On 12/27/11 11:02 PM, roze...@volny.cz wrote: Hallo, I have kind of special question when extening python with C++ implemented modules. I try to implement a class, behaving also like an array. And I need to implement slice-getters. I implemented PySequenceMethods.sq_slice to get "simple" slices

Re: Slices when extending python with C++

2011-12-27 Thread Ian Kelly
2011/12/27 : > Hallo, > I have kind of special question when extening python with C++ > implemented modules. > > I try to implement a class, behaving also like an array. And I need > to implement slice-getters. I implemented PySequenceMethods.sq_slice > to get "simple" slices like: > > myobj[x:y]

Slices when extending python with C++

2011-12-27 Thread rozelak
Hallo, I have kind of special question when extening python with C++ implemented modules. I try to implement a class, behaving also like an array. And I need to implement slice-getters. I implemented PySequenceMethods.sq_slice to get "simple" slices like: myobj[x:y] It works perfectly, without p

Slices when extending python with C++

2011-12-27 Thread rozelak
Hallo, I have kind of special question when extening python with C++ implemented modules. I try to implement a class, behaving also like an array. And I need to implement slice-getters. I implemented PySequenceMethods.sq_slice to get "simple" slices like: myobj[x:y] It works perfectly, without p

Re: Extending Python with C or C++

2009-01-09 Thread Nick Craig-Wood
Thomas Heller wrote: > Nick Craig-Wood schrieb: > > Thomas Heller wrote: > >> Nick Craig-Wood schrieb: > >> > Interesting - I didn't know about h2xml and xml2py before and I've > >> > done lots of ctypes wrapping! Something to help with the initial > >> > drudge work of converting the structur

Re: Extending Python with C or C++

2009-01-08 Thread Thomas Heller
Nick Craig-Wood schrieb: > Thomas Heller wrote: >> Nick Craig-Wood schrieb: >> > Interesting - I didn't know about h2xml and xml2py before and I've >> > done lots of ctypes wrapping! Something to help with the initial >> > drudge work of converting the structures would be very helpful. >> > >>

Re: Extending Python with C or C++

2009-01-07 Thread Nick Craig-Wood
Thomas Heller wrote: > Nick Craig-Wood schrieb: > > Interesting - I didn't know about h2xml and xml2py before and I've > > done lots of ctypes wrapping! Something to help with the initial > > drudge work of converting the structures would be very helpful. > > > > ( http://pypi.python.org/pypi/c

Re: Extending Python with C or C++

2009-01-07 Thread Thomas Heller
Nick Craig-Wood schrieb: > Ralf Schoenian wrote: >> Ryan wrote: >> > I've been using Python for many years now. It's a wonderful language >> > that I enjoy using everyday. I'm now interested in getting to know >> > more about the guts (C/C++) and extending it. But, extending python >> > still see

Re: Extending Python with C or C++

2009-01-06 Thread sturlamolden
On Jan 5, 9:06 pm, Ryan wrote: > I've been using Python for many years now. It's a wonderful language > that I enjoy using everyday. I'm now interested in getting to know > more about the guts (C/C++) and extending it. But, extending python > still seems like a black art to me. There are severa

Re: Extending Python with C or C++

2009-01-06 Thread Nick Craig-Wood
Ralf Schoenian wrote: > Ryan wrote: > > I've been using Python for many years now. It's a wonderful language > > that I enjoy using everyday. I'm now interested in getting to know > > more about the guts (C/C++) and extending it. But, extending python > > still seems like a black art to me. Is th

Re: Extending Python with C or C++

2009-01-06 Thread Stefan Behnel
Ryan wrote: > 3. Extending CPython by connecting it to Python-oblivious code written > in C with Ctypes (Ralf's suggestion is good for this) > 4. Extending CPython by connecting it to Python-aware (and specific) > code using the CPython C-API functions (http://docs.python.org/c-api/) For extending

Re: Extending Python with C or C++

2009-01-05 Thread Ryan
On Jan 5, 2:37 pm, Terry Reedy wrote: > Ryan wrote: > > I've been using Python for many years now. It's a wonderful language > > that I enjoy using everyday. I'm now interested in getting to know > > more about the guts > > The 'guts' of Python the language include the object model, namespaces > (

Re: Extending Python with C or C++

2009-01-05 Thread Terry Reedy
Ryan wrote: I've been using Python for many years now. It's a wonderful language that I enjoy using everyday. I'm now interested in getting to know more about the guts The 'guts' of Python the language include the object model, namespaces (including modules), and the statement and infix-expres

Re: Extending Python with C or C++

2009-01-05 Thread Ralf Schoenian
Ryan wrote: I've been using Python for many years now. It's a wonderful language that I enjoy using everyday. I'm now interested in getting to know more about the guts (C/C++) and extending it. But, extending python still seems like a black art to me. Is there anymore docs or info on extending it

Extending Python with C or C++

2009-01-05 Thread Ryan
I've been using Python for many years now. It's a wonderful language that I enjoy using everyday. I'm now interested in getting to know more about the guts (C/C++) and extending it. But, extending python still seems like a black art to me. Is there anymore docs or info on extending it besides the s

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread John Machin
On Jun 20, 5:56 am, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] nomine.org> wrote: > -On [20080619 17:11], Spectrum ([EMAIL PROTECTED]) wrote: > > > ImportError: dynamic module does not define init function > > Might be it's looking, but not finding, something like crti.S or the likes, > the

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread André Malo
* Jeroen Ruigrok van der Werven wrote: > -On [20080619 17:11], Spectrum ([EMAIL PROTECTED]) wrote: >> ImportError: dynamic module does not define init function > > Might be it's looking, but not finding, something like crti.S or the > likes, the C runtime files that specify stuff like _init and

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread Jeroen Ruigrok van der Werven
-On [20080619 17:11], Spectrum ([EMAIL PROTECTED]) wrote: > ImportError: dynamic module does not define init function Might be it's looking, but not finding, something like crti.S or the likes, the C runtime files that specify stuff like _init and _fini. -- Jeroen Ruigrok van der Werven / asmo

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread Spectrum
On Jun 19, 4:39 pm, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] nomine.org> wrote: > -On [20080619 16:21], Spectrum ([EMAIL PROTECTED]) wrote: > > >          libmpi.so.0 => /usr/lib/openmpi/1.2.4-gcc/libmpi.so.0 > >(0x0042f000) > >          libopen-rte.so.0 => /usr/lib/openmpi/1.2.4-gcc/libope

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread Jeroen Ruigrok van der Werven
-On [20080619 16:21], Spectrum ([EMAIL PROTECTED]) wrote: > libmpi.so.0 => /usr/lib/openmpi/1.2.4-gcc/libmpi.so.0 >(0x0042f000) > libopen-rte.so.0 => /usr/lib/openmpi/1.2.4-gcc/libopen- >rte.so.0 (0x003d4000) > libopen-pal.so.0 => /usr/lib/openmpi/1.2.4-gcc/libopen- >pal.

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread Spectrum
On Jun 19, 2:10 pm, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] nomine.org> wrote: > -On [20080619 13:53], Spectrum ([EMAIL PROTECTED]) wrote: > > >  ImportError: /big/School/Cluster/Opgave03/ctest.so: undefined > >symbol: ompi_mpi_comm_world > > [EMAIL PROTECTED] Opgave03]$ > > >  Can anyone

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread Jeroen Ruigrok van der Werven
-On [20080619 13:53], Spectrum ([EMAIL PROTECTED]) wrote: > ImportError: /big/School/Cluster/Opgave03/ctest.so: undefined >symbol: ompi_mpi_comm_world > [EMAIL PROTECTED] Opgave03]$ > > Can anyone suggest anything? Can I get MPI to work in Python? Sounds like a typical case of not specifying an

Extending Python with C: Cannot find MPI library

2008-06-19 Thread Spectrum
I am writing some Python code using the Message Passing Interface (MPI), an API used in parallel computing. There exist a number of Python implementations of MPI, but apparently they all rely on the Numeric Python (numpy) package. I need to run my code on a particular machine made available by my

Re: Extending Python with C: Can I specify another C compiler?

2008-06-04 Thread Ivan Illarionov
On Wed, 04 Jun 2008 09:12:18 -0700, spectrumdt wrote: > Hello. > > I am trying to extend my Python program with some C code. > > This thread is sort of a follow-up to another thread of mine, linked > below. I don't know what the conventions are in this newsgroup about > creating new threads

Re: Extending Python with C: Can I specify another C compiler?

2008-06-04 Thread Ivan Illarionov
On Wed, 04 Jun 2008 09:12:18 -0700, spectrumdt wrote: > Hello. > > I am trying to extend my Python program with some C code. > > This thread is sort of a follow-up to another thread of mine, linked > below. I don't know what the conventions are in this newsgroup about > creating new threads

Re: Extending Python with C: Can I specify another C compiler?

2008-06-04 Thread Ivan Illarionov
On Wed, 04 Jun 2008 09:12:18 -0700, spectrumdt wrote: > Hello. > > I am trying to extend my Python program with some C code. > > This thread is sort of a follow-up to another thread of mine, linked > below. I don't know what the conventions are in this newsgroup about > creating new threads

Re: Extending Python with C: Can I specify another C compiler?

2008-06-04 Thread spectrumdt
On Jun 4, 6:25 pm, Gerhard Häring <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >   Hello. > > >   I am trying to extend my Python program with some C code. [...] > >   Anyway, my question is this: When compiling my C code to include in > > Python, using a Python script with the function

Re: Extending Python with C: Can I specify another C compiler?

2008-06-04 Thread Gerhard Häring
[EMAIL PROTECTED] wrote: Hello. I am trying to extend my Python program with some C code. [...] Anyway, my question is this: When compiling my C code to include in Python, using a Python script with the function distutils.core.setup... can I choose which C compiler to use? On my system it

Extending Python with C: Can I specify another C compiler?

2008-06-04 Thread spectrumdt
Hello. I am trying to extend my Python program with some C code. This thread is sort of a follow-up to another thread of mine, linked below. I don't know what the conventions are in this newsgroup about creating new threads vs. staying in existing ones, but I figured I'd rather make a new o

Re: Extending Python with C API

2007-10-18 Thread Sami Vaisanen
On Thu, 13 Sep 2007 21:26:33 -0400, Carsten Haese wrote: > On Thu, 2007-09-13 at 18:05 -0700, Thierry Masson wrote: >> Hello, >> >> I'm trying to use the C API to extend Python. I've looked at various >> books and web sites (including the docs at python.org) and I can't get >> any of the samples

Re: Extending Python with C API

2007-09-13 Thread Thierry Masson
On 9/13/07, Carsten Haese wrote: >Your module C code uses an unknown function by the name of PyBuildValue. >The actual name of the function you mean is Py_BuildValue. Thank you so much, Carsten. I can't believe I missed that underscore! I'm posting the working code below in case it ever turns out

Re: Extending Python with C API

2007-09-13 Thread Carsten Haese
On Thu, 2007-09-13 at 18:05 -0700, Thierry Masson wrote: > Hello, > > I'm trying to use the C API to extend Python. I've looked at various > books and web sites (including the docs at python.org) and I can't get > any of the samples to work. Below is a very minimalist example that > I'm trying to

Extending Python with C API

2007-09-13 Thread Thierry Masson
Hello, I'm trying to use the C API to extend Python. I've looked at various books and web sites (including the docs at python.org) and I can't get any of the samples to work. Below is a very minimalist example that I'm trying to get working and I was wondering if someone could tell me where I'm go

Re: beginner questions on embedding/extending python with C++

2006-08-09 Thread Hoop
Hi All, I am in the process also of trying to call Python script from a C++ windows app. I have looked at the Boost site and am currently reading over the Embedding portion of the tutorial. A question I have is that there appear to be about 4 or 5 Boost items avaiable for download. Which one should

Re: beginner questions on embedding/extending python with C++

2006-08-08 Thread Qun Cao
Thanks for all the good pointers! I am still reading throught them, but Boost seems to be the way to go! Roman Yakovenko wrote: > On 8 Aug 2006 02:28:31 -0700, Qun Cao <[EMAIL PROTECTED]> wrote: > > Hi Everyone, > > > > I am a beginner on cross language development. My problem at hand is to > > bu

Re: beginner questions on embedding/extending python with C++

2006-08-08 Thread Qun Cao
Thanks Diez, It is a good relief that I only need to wrap the classes I need. I decide to try Boost first because it seems to have a wider audience than SIP, but I would definately look into SIP if I want to do Qt development in the future. Diez B. Roggisch wrote: > > Since the main program is s

Re: beginner questions on embedding/extending python with C++

2006-08-08 Thread Ben Sizer
Qun Cao wrote: > Hi Everyone, > > I am a beginner on cross language development. My problem at hand is to > build a python interface for a C++ application built on top of a 3D > game engine. The purpose of this python interface is providing a > convenient scripting toolkit for the application. As

Re: beginner questions on embedding/extending python with C++

2006-08-08 Thread Roman Yakovenko
On 8 Aug 2006 02:28:31 -0700, Qun Cao <[EMAIL PROTECTED]> wrote: > Hi Everyone, > > I am a beginner on cross language development. My problem at hand is to > build a python interface for a C++ application built on top of a 3D > game engine. The purpose of this python interface is providing a > con

Re: beginner questions on embedding/extending python with C++

2006-08-08 Thread Diez B. Roggisch
> Since the main program is still going to be the C++ application, I > guess we need to embedding the python scripts in the C++ code. So at > initialization stage, the python script needs to be loaded into the C++ > code. And this code can be simple, like > player = Player() > game.loadPlayer(pla

beginner questions on embedding/extending python with C++

2006-08-08 Thread Qun Cao
can write a python script like: player = Player() game.loadPlayer(player) player.moveTo(location) To configure the game environment. I am trying to figure out how to make this happen. I only have the vague idea that this concerns embedding/extending python with C

Re: Extending Python with C++

2005-12-29 Thread jeremito
Unfortunately, I need to know a bit more than just the concept 'extern "C"'. I am really slow at this. Can anyone point me towards some examples or a tutorial (other than the one from python.org, I didn't understand that one)? Thanks, Jeremy -- http://mail.python.org/mailman/listinfo/python-lis

Re: Extending Python with C++

2005-12-29 Thread Brian van den Broek
Brian van den Broek said unto the world upon 29/12/05 12:03 PM: > jeremito said unto the world upon 29/12/05 11:39 AM: > >>I am learning how to extend Pythong with C++. I have will be writing >>some code in C++ and want/need Python to interact with it. I am not >>having success following the onl

Re: Extending Python with C++

2005-12-29 Thread Martin v. Löwis
jeremito wrote: > Oops, sorry. My question is, how can I know if my Python interpreter > was lined by C++? Ah. This documentation fragment is somewhat wrong: it depends on the target operating system and compiler whether you have to link main with a C++ compiler. For many modern systems, this isn

Re: Extending Python with C++

2005-12-29 Thread jeremito
Oops, sorry. My question is, how can I know if my Python interpreter was lined by C++? The non-specific questions are, of course, does anyone have any hints or suggestions? Good websites to visit? Thanks, Jeremy -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python with C++

2005-12-29 Thread Brian van den Broek
jeremito said unto the world upon 29/12/05 11:39 AM: > I am learning how to extend Pythong with C++. I have will be writing > some code in C++ and want/need Python to interact with it. I am not > having success following the online documentation from > http://docs.python.org/ext/ext.html. I have

Re: Extending Python with C++

2005-12-29 Thread Fredrik Lundh
"jeremito" <[EMAIL PROTECTED]> wrote: > I have one specific question. The documentation online states: > > "If the main program (the Python interpreter) is compiled and linked by > the C compiler, global or static objects with constructors cannot be > used. This is not a problem if the main progr

Extending Python with C++

2005-12-29 Thread jeremito
I am learning how to extend Pythong with C++. I have will be writing some code in C++ and want/need Python to interact with it. I am not having success following the online documentation from http://docs.python.org/ext/ext.html. I have also looked briefly at some of the demos in the source code