Doubt C and Python

P

praba kar

Dear All,
I want to know the link between c and python.
Some people with C background use Python instead
of programming in C.why?



regards
Prabahar






____________________________________________________
Send a rakhi to your brother, buy gifts and win attractive prizes. Log on to http://in.promos.yahoo.com/rakhi/index.html
 
W

Will McGugan

praba said:
Dear All,
I want to know the link between c and python.
Some people with C background use Python instead
of programming in C.why?

Because I can create software many times faster. And its more fun.

Will McGugan
 
S

Sybren Stuvel

Will McGugan enlightened us with:
Because I can create software many times faster. And its more fun.

Same here. And because it's very easy to write unittests, for
instance.

Sybren
 
J

Jeff Schwab

praba said:
Dear All,
I want to know the link between c and python.
Some people with C background use Python instead
of programming in C.why?

For me, the choice is typically among C++, Perl, Python, and Java. The
arguments for Python relative to these languages are:

1. Python's standard library includes a lot of functionality not in the
C++ standard library.

2. Python's syntax is the cleanest of these languages.

3. I don't have to compile Python, so I can test changes much more
quickly that with C++ or Java.

4. System calls made from Python are more likely to be portable among
the platforms I use most (WindowsXP, AIX, Linux, and MacOSX) than system
calls from C++.

5. Scripting is easier in Python than in Java, particularly with regard
to environment variables and process control.

Of course, these are only my opinions. I am particularly not an expert
on Python or Java.
 
G

Grant Edwards

I want to know the link between c and python.
Some people with C background use Python instead
of programming in C.why?

Because C is a dangerous, low-level language unsuitable for
general-purposed application programming.

I use C for:

1) Real-time, embedded stuff where memory is measured in KB
rather than MB.

2) Device drivers where the other choice is assembly.
 
W

Wouter van Ooijen

I want to know the link between c and python.

Apart from the fact that the inner part of Python is written in C I
know no link?
Some people with C background use Python instead
of programming in C.why?

I use Python when my time is most valuable (in most cases it is), in
the very few cases the computer's time is more valuable I write in
C/C++.


Wouter van Ooijen

-- ------------------------------------
http://www.voti.nl
Webshop for PICs and other electronics
http://www.voti.nl/hvu
Teacher electronics and informatics
 
W

Wouter van Ooijen

For me, the choice is typically among C++, Perl, Python, and Java. The
arguments for Python relative to these languages are:

add: I develop on my platform (which happens to be XP, but that is
irrelevant), I put the Python source on my website, and I never worry
about the platform my users will be using. An those users don't need
to know how to compile a program, it will just run.
Wouter van Ooijen

-- ------------------------------------
http://www.voti.nl
Webshop for PICs and other electronics
http://www.voti.nl/hvu
Teacher electronics and informatics
 
T

Terry Hancock

For the same reason that people acquainted with assembly
language nevertheless chose to write software in C. It is a
higher level language.

That generally translates to:

1) Gettng much more done in much less time.

2) Being able to think about the problem at a more
abstract level, and not getting befuddled with trivia.

3) Fewer bugs (there is a claim that bugs are directly
proportional to lines of code, so that any language that
allows you to get the job done with fewer LOC will also
allow you to do it with fewer bugs).

4) The result is usually slower and bulkier, being less
hand optimized.

1,2, & 3 are definitely advantages.

4 is a disadvantage, but there are reasons not to worry
about it:

* CPU time and memory progress rapidly enough
that wasting expensive programmer time on reducing
them is often a poor trade.

* The claim that a Human can optimize code better than
the compiler assumes a very smart and talented Human,
and/or a very dumb compiler. Compilers are getting smarter,
and since a lot more people find the need to program, the
average programmer is not that talented. I'm pretty I'm
not, for example -- I'll take my chances with the compiler. ;-)

Cheers,
Terry
 
M

michael

Dear All,
I want to know the link between c and python.
Some people with C background use Python instead
of programming in C.why?



regards
Prabahar
Just my $.02

I am a long time c/c++ programmer (by profession). I fell in love with
python about 2 years ago. I use python for many things now, and I always
have said, "When it is too slow, I will write it in c++".

I have not hit that point yet. For some reasons that are hard to explain,
even though python "should" be slower and maybe even is sometimes, it
never is an issue.

One reason is that python has so much better data structures built in, and
THEY are written in C, I end up with faster code. For example, if I am
doing a bunch of string compares in C, I would use a dictionary in python.
Python ends up faster because I can get to a better algorithm FASTER.

The other reason is that so many times, a hardware I/O device is really
the limiting factor (such as a hard disc, or a serial/network connection,
or waiting for the user).

I have found that GUI programs written in python/wxpython to be every bit
as fast as pure C++. I guess you could say that because the LIBRARIES of
python are in C, and because you are never very far from a library call,
you end up running C code a large percentage of the time, even when you
are writing in Python.

My advice is to just TRY python and resolve the "slow" speed if you ever
hit it. I never have and I write a lot of code, even hardcore math and
image processing (See PIL - python Imaging Library).

Michael
 
U

Uwe Schmitt

Just my $.02

I am a long time c/c++ programmer (by profession). I fell in love with
python about 2 years ago. I use python for many things now,
and I always
have said, "When it is too slow, I will write it in c++".

I have not hit that point yet. For some reasons that are hard
to explain,
even though python "should" be slower and maybe even is sometimes, it
never is an issue.

I made the same experience. The only reason I have for using C++
is number crunching. And I love boost python for building the bridge.

Greetings, Uwe.
 
J

James Kim

Jeff said:
5. Scripting is easier in Python than in Java, particularly with
regard to environment variables and process control.

Of course, these are only my opinions. I am particularly not an expert
on Python or Java.

Note that for Java experts, Jython can be used for interpreting works.
Jython has the same grammer to Python, or CPython, and is also able to
call Java codes very simply.

See, for example: http://www.jython.org/docs/usejava.html

-James (^o^)
 
J

James Kim

Wouter said:
I use Python when my time is most valuable (in most cases it is), in
the very few cases the computer's time is more valuable I write in
C/C++.

In cases when the computer's time is more valuable, why not use CPython
with C/C++ API? Only most time consuming parts can be replaced to C/C++
codes so as to increase the speed up to native C/C++ programs).

-James (^o^)
 
W

Wouter van Ooijen

I use Python when my time is most valuable (in most cases it is), in
In cases when the computer's time is more valuable, why not use CPython
with C/C++ API? Only most time consuming parts can be replaced to C/C++
codes so as to increase the speed up to native C/C++ programs).

That assumes that one knows which are the most time-consuming parts,
that they are few (which is typically, but not always, the case) and
that they are 'fit' to be transferred to the C/C++ domain. The one
application I have written the last few years that probably would not
be fit to this approach is a compiler (Jal). It spends most of its
time walking the annotated syntax tree, with a lot of code
contributing rather evenly to the CPU time.

Don't take me wrong, IIRC that is the *only* PC program I have written
the last few years for which I selected the language and the language
was not Python :)

But I mainly program PICs. Where is the 10F200 Python interpreter when
you need one?


Wouter van Ooijen

-- ------------------------------------
http://www.voti.nl
Webshop for PICs and other electronics
http://www.voti.nl/hvu
Teacher electronics and informatics
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top