473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Doubt C and Python

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
Aug 23 '05 #1
14 1276
> Some people with C background use Python instead
of programming in C.why?


Becuase it is much more efficient.

-James

Aug 23 '05 #2
praba kar wrote:
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
--
http://www.kelpiesoft.com
Aug 23 '05 #3
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
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
Aug 23 '05 #4
praba kar wrote:
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.
Aug 23 '05 #5
On 23 Aug 2005 01:22:31 -0700
James wrote:
Some people with C background use Python instead
of programming in C.why?


Becuase it is much more efficient.


It's rather because _they_ are much more efficient (that is, with Python).

--
jk
Aug 23 '05 #6
On 2005-08-23, praba kar <pr*********@yahoo.co.in> wrote:
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.
--
Grant Edwards grante Yow! I will invent "TIDY
at BOWL"...
visi.com
Aug 23 '05 #7
> 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
Aug 23 '05 #8
>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
Aug 23 '05 #9
On Tuesday 23 August 2005 06:28 am, Will McGugan wrote:
praba kar wrote:
I want to know the link between c and python.
Some people with C background use Python instead
of programming in C.why?


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

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks http://www.anansispaceworks.com

Aug 24 '05 #10
On Tue, 23 Aug 2005 06:15:03 +0100, praba kar wrote:
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
Aug 25 '05 #11
>
On Tue, 23 Aug 2005 06:15:03 +0100, praba kar wrote:
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.


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.
Aug 25 '05 #12
Jeff Schwab wrote:
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^)
Aug 28 '05 #13
Wouter van Ooijen (www.voti.nl) wrote:
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^)
Aug 28 '05 #14
>> 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).


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
Aug 28 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: praba kar | last post by:
Dear All, I have doubt regarding sorting. I have a list that list have another list (eg) list = ,,] I want to sort only numeric value having array field. How I need to do for that.
1
by: praba kar | last post by:
Dear all, I have doubt regarding python Compilation. I want to know whether Python is compiler language or interpreted language. If Python is interpreter language why compilation is there. ...
8
by: =?UTF-8?B?4LSc4LSX4LSo4LWN4LSo4LS+4LSl4LWN?= | last post by:
Friends I am a Perl programmer new to Python. I have a small doubt. How to convert the perl notation $a = ""; expression in Python ? How to represent the loop for ($a = $b; $a<=$c;$a++){ }...
1
by: sridhard2406 | last post by:
Hi All, I am new to c++, please find my program below and my doubt as mentioned below. #include <iostream> using namespace std; class base { public:
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.