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

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 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

Why doesn't this work--Extending Python--?

2006-01-04 Thread jeremito
I have written a simple C++ program in my efforts to learn how to extend Python. It is shown below. Everything compiles and installs correctly, but I get strange answers. I know the function "Pi" is correct because when I call it from a C++ code it gives the correct answers. This is what I get

Re: Why doesn't this work--Extending Python--?

2006-01-04 Thread jeremito
Well what do you know, that worked! It's one of those errors that you can't see yourself, but someone else can see it instantly. Thanks, Jeremy -- http://mail.python.org/mailman/listinfo/python-list

Convert string to mathematical function

2006-08-01 Thread jeremito
I am extending python with C++ and need some help. I would like to convert a string to a mathematical function and then make this a C++ function. My C++ code would then refer to this function to calculate what it needs. For example I want to tell my function to calculate "x^2 + 3x +2", but later

Re: Convert string to mathematical function

2006-08-02 Thread jeremito
I was unaware of the exec and eval functions in Python. Without trying them, they seem to be what I want to do. I'll play around with it and see if I can figure it out. Thanks for the suggestions everyone. Jeremy -- http://mail.python.org/mailman/listinfo/python-list

Extending/Embedding Confusion

2006-08-04 Thread jeremito
I am trying to learn how to extend and/or embed Python. I have looked at the document "Extending and Embedding the Python Interpreter" and also "Python/C API Reference Manual. In the examples shown in "Extending..." there are some things I ma not familiar with so I turn to the index in the Refere

string formatter for tuple

2006-11-02 Thread jeremito
I have the following in my code a = (1,2,3) print "a = %s" %a But when I run this, I get: TypeError: not all arguments converted during string formatting Now I realize why this happens, a is actually 3 elements when the print statement is only expecting to print one value. I tried print "a =

Re: string formatter for tuple

2006-11-02 Thread jeremito
[EMAIL PROTECTED] wrote: > > "Tim" == Tim Chase <[EMAIL PROTECTED]> writes: > > >> How can I print a tuple with a single string format? > > Tim>print "a = %s" % str(a) > Tim> or > Tim>print "a = %s" % repr(a) > > Or wrap the tuple in a tuple: > > print "a =

What is proper way to require a method to be overridden?

2007-01-04 Thread jeremito
I am writing a class that is intended to be subclassed. What is the proper way to indicate that a sub class must override a method? Thanks, Jeremy -- http://mail.python.org/mailman/listinfo/python-list

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread jeremito
Gabriel Genellina wrote: > At Thursday 4/1/2007 23:52, jeremito wrote: > > >I am writing a class that is intended to be subclassed. What is the > >proper way to indicate that a sub class must override a method? > > If any subclass *must* override a method, raise NotImplem

Python module for making Quicktime or mpeg movies from images

2007-10-11 Thread jeremito
My Python script makes a bunch of images that I want to use as frames in a movie. I've tried searching for a module that will take these images and put them together in a Quicktime or mpeg movie, but haven't found anything. My images are currently pdfs, but I could make them into just about anyth

Re: Python module for making Quicktime or mpeg movies from images

2007-10-11 Thread jeremito
On Oct 11, 10:43 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > jeremito wrote: > > My Python script makes a bunch of images that I want to use as frames > > in a movie. I've tried searching for a module that will take these > > images and put them

Re: Python module for making Quicktime or mpeg movies from images

2007-10-12 Thread jeremito
On Oct 12, 10:37 am, TYR <[EMAIL PROTECTED]> wrote: > On Oct 11, 4:17 pm, Tim Golden <[EMAIL PROTECTED]> wrote: > > > > > jeremito wrote: > > > On Oct 11, 10:43 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > >> jeremito wro

Re: Python module for making Quicktime or mpeg movies from images

2007-10-15 Thread jeremito
On Oct 13, 5:30 am, has <[EMAIL PROTECTED]> wrote: > On 12 Oct, 20:53, jeremito <[EMAIL PROTECTED]> wrote: > > > I actually found NodeBox in my googling. This seems to be a stand > > alone application. I need to be able to convert my images to a movie > > f

Help me override append function of list object

2007-01-30 Thread jeremito
I have created a class that inherits from the list object. I want to override the append function to allow my class to append several copies at the same time with one function call. I want to do something like: import copy class MyList(list): __init__(self): pass def append(self, ob

Re: Help me override append function of list object

2007-01-30 Thread jeremito
On Jan 30, 10:47 am, Peter Otten <[EMAIL PROTECTED]> wrote: > jeremito wrote: > > I have created a class that inherits from the list object. I want to > > override the append function to allow my class to append several > > copies at the same time with one f

how to add class attributes in __new__

2007-02-01 Thread jeremito
I am subclassing the array class and have __new__ to initialize and create my class. In that class I create not only do I create an array object, but I also create some other data in __new__ I want to have access to outside of __new__. I tried self.mydata = mydata but that didn't work. Can som

How can I use __setitem__ method of dict object?

2007-02-06 Thread jeremito
Please excuse me if this is obvious to others, but I can't figure it out. I am subclassing dict, but want to prevent direct changing of some key/value pairs. For this I thought I should override the __setitem__ method as such: class xs(dict): """ XS is a container object to hold informa

Re: How can I use __setitem__ method of dict object?

2007-02-06 Thread jeremito
On Feb 6, 10:59 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 6 fév, 16:23, "jeremito" <[EMAIL PROTECTED]> wrote: > > > > > Please excuse me if this is obvious to others, but I can't figure it > > out. I am subclassing di

Re: How can I use __setitem__ method of dict object?

2007-02-06 Thread jeremito
On Feb 6, 2:36 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > jeremito a écrit : > > > > > On Feb 6, 10:59 am, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > >>On 6 fév, 16:23, "jeremito" <[EMAIL PROTECTED]>

Re: How can I use __setitem__ method of dict object?

2007-02-07 Thread jeremito
On Feb 6, 5:10 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > jeremito a écrit : > > On Feb 6, 2:36 pm, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > > > > (snip) > > >>Here's an alternative implementation, so you get the idea. >

Re: How can I use __setitem__ method of dict object?

2007-02-07 Thread jeremito
On Feb 7, 8:28 am, "jeremito" <[EMAIL PROTECTED]> wrote: > On Feb 6, 5:10 pm, Bruno Desthuilliers > > > > <[EMAIL PROTECTED]> wrote: > > jeremito a écrit : > > > On Feb 6, 2:36 pm, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: >

Re: How can I use __setitem__ method of dict object?

2007-02-07 Thread jeremito
On Feb 7, 12:48 pm, Jussi Salmela <[EMAIL PROTECTED]> wrote: > jeremito kirjoitti: > > > On Feb 7, 8:28 am, "jeremito" <[EMAIL PROTECTED]> wrote: > >> On Feb 6, 5:10 pm, Bruno Desthuilliers > > >> <[EMAIL PROTECTED]> wrote: > >&g

Distutils -- specifying compiled output name

2006-05-25 Thread jeremito
I am using distutils to comiple/install a c extension created with SWIG. However I need to be able to specify the output filename from gcc. I tried doing this with the "extra_compile_args" and "extra_link_args" by setting them equal to "-o MyOutputName.so" but that didn't work. Can someone show

Removing compile option in distutils

2007-12-27 Thread jeremito
Hello all, I am using distutils for building/compiling my Python extensions. The default configuration tells the compiler to generate debug information with the "-g" flag. I don't want this, but I can't seem to figure out how to get rid of it. Does anyone now how? Thanks, Jeremy -- http://mai