I think jeff gave the most succint advice as to your question. You
should consider your problem carefully and decide if that is what you
really need. And when in doubt consult the 'documentation.'
(http://docs.python.org/ext/ext.html)
--
bitshadow
---
Brad Tilley wrote:
Is it possible to write a file open, then read program in C and then
call the C program from a Python script like this:
for root, files, dirs in os.walk(path)
for f in files:
try:
EXECUTE_C_PROGRAM
If possible, how much faster would this be over a pure P
"Brad Tilley" <[EMAIL PROTECTED]> wrote:
>>>I'm dealing with a terabyte of files. Perhaps I should have mentioned
>>>that.
I wouldn't automatically assume that recursing the directories with a Python
script that calls a C program for each file is faster than doing the
processing in Python. Fo
Brad Tilley wrote:
I just want to know the basics of using C and Python together when the
need arises, that's all, I don't want to write a book about what
exactly it is that I'm involved in.
Well, there's several different ways of using C and Python together, so
the only meaningful answer we ca
Hi Brad
Not that I'm an expert but note:
1. If you already know C, fair enough. You should know what you are
getting into then. I sure as heck don't know it very well at all and I'm
not gonna make that time investment now. MAYBE if I really really needed
the extra speed (but this seems to
On 2004-12-09, Brad Tilley <[EMAIL PROTECTED]> wrote:
> I just want to know the basics of using C and Python together
> when the need arises, that's all, I don't want to write a book
> about what exactly it is that I'm involved in.
>
> I'm going to take It's Me's advice and have a look at SWIG.
T
Grant Edwards wrote:
On 2004-12-09, Brad Tilley <[EMAIL PROTECTED]> wrote:
Steven Bethard wrote:
for root, files, dirs in os.walk(path)
for f in files:
try:
x = file(f, 'rb')
data = x.read()
x.close()
Remember that CPython is implemented in C, and so
On 2004-12-09, Brad Tilley <[EMAIL PROTECTED]> wrote:
> Steven Bethard wrote:
for root, files, dirs in os.walk(path)
for f in files:
try:
x = file(f, 'rb')
data = x.read()
x.close()
>>
>>
>> Remember that CPython i
On 2004-12-09, Brad Tilley <[EMAIL PROTECTED]> wrote:
>> You're going to have to explain clearly what you mean by
>> "EXECUTE_C_PROGRAM". If you want to, you can certainly run a
>> binary executable that was generated from C source, (e.g. an
>> ELF file under Linux or whatever a .exe file is unde
Steven Bethard wrote:
for root, files, dirs in os.walk(path)
for f in files:
try:
x = file(f, 'rb')
data = x.read()
x.close()
Remember that CPython is implemented in C, and so all the builtin types
(including file) basically execute C code dire
It's me wrote:
I would expect C to run circles around the same operation under Python.
You should probably only expect C to run circles around the same
operations when those operations implemented entirely in Python. In the
specific (trivial) example given, I wouldn't expect Python to be much
s
Brad Tilley wrote:
> for root, files, dirs in os.walk(path)
> for f in files:
> try:
> EXECUTE_C_PROGRAM
http://docs.python.org/lib/module-subprocess.html
this module in new in 2.4; for older version, os.system() or the os.popen()
family might be what you're looking fo
I would expect C to run circles around the same operation under Python. As
a general rule of thumb, you should use C for time cirtical operations
(computer time, that is), and use Python for human time critical situations
(you can get a program developed much faster).
I just discovered a magical
Grant Edwards wrote:
Huh? What do you mean "write a file open"? You want to read a
C source file and execute the C source? If you have access to
a C interpreter, I guess you could invoke the interpreter from
python using popen, and feed the C source to it. Alternatively
you could invoke a compi
Brad Tilley wrote:
If possible, how much faster would this be over a pure Python solution?
It is like the difference between Batman and Ever.
batman is faster than ever
--
http://mail.python.org/mailman/listinfo/python-list
On 2004-12-09, Brad Tilley <[EMAIL PROTECTED]> wrote:
> Is it possible to write a file open, then read program in C and then
> call the C program from a Python script like this:
Huh? What do you mean "write a file open"? You want to read a
C source file and execute the C source? If you have a
Is it possible to write a file open, then read program in C and then
call the C program from a Python script like this:
for root, files, dirs in os.walk(path)
for f in files:
try:
EXECUTE_C_PROGRAM
If possible, how much faster would this be over a pure Python solution?
Tha
17 matches
Mail list logo