[wingide-users] Best environment for Python/C development

Wing IDE Support support at wingware.com
Thu Feb 24 10:48:16 EST 2005


On Thu, 24 Feb 2005 gary.h.merrill at GSK.COM wrote:
> This is one of those horrible "What is the best ...?"  questions that of 
> course have no unique answer.  But I'd appreciate some feedback based on 
> experience.
> 
> I'm finally at the point where I need to implement some things in C since 
> the Python implementations are *way* too slow.  I'd like to be able to 
> debug my combined Python and C code as straightforwardly as possible.  I 
> gather that this can be done via a route using wingstub, and I can 
> probably figure out the details of that since I've used wingstub before to 
> debug spawned processes.
> 
> My question is this:  Assuming development on and for Windows, what C 
> development environment seems best for this sort of thing?  I've got (a) 
> Borland V6 -- which I am starting to find pretty irritating since it 
> want's to crash in some circumstances and I don't think much of its data 
> display features, and (b) MS Visual .Net  (2003) which I've rather 
> studiously avoided for a couple of years because its complexity somewhat 
> bewilders me.
> 
> Any experience or thoughts on this?  Would something like CodeWarrier be a 
> better choice?

I can't really answer which is the best development environment
but there's a very brief how-to for debugging both C and Python
at the same time:

http://wingware.com/doc/howtos/debug-c-cpp

As far as approach to writing C code in general, some notes that 
might be useful to you or others in this position:

>From working on Wing itself, which has some very performance
critical parts, we've learned somewhat the hard way that the best
way to go is to absolutely minimize the amount of C written.  In
the past, we somewhat blindly rewrote whole modules as units, and
now we just rewrite single optimized functions based on running
code in the Python profiler first.  This is a much more
productive approach.

In general, learning a few tricks in Python may also help in some
cases. For example, don't do this:

txt = ''
for something in whatever:
  txt += something

Instead do this:

txt = []
for something in whatever:
  txt.append(something)
txt = ''.join(txt)

Similarly, using "%s%s%s" % (x, y, z) is better than x + y + z.

There are others worth knowing about here:

http://manatee.mojam.com/~skip/python/fastpython.html

You may also want to look at Pyrex, which lets you mix
Python and C data types and creates C extensions modules
for you:

http://nz.cosc.canterbury.ac.nz/~greg/python/Pyrex/

I haven't used it yet but it could save you a lot of time over
writing C code by hand.

Hope that's useful, even if not exactly what you asked about...

- Stephan



More information about the wingide-users mailing list