Re: Doubt C and Python

2005-08-28 Thread James Kim
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^)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doubt C and Python

2005-08-28 Thread James Kim
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^)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doubt C and Python

2005-08-28 Thread Wouter van Ooijen (www.voti.nl)
 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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doubt C and Python

2005-08-25 Thread Ben Sizer
Grant Edwards wrote:
 On 2005-08-23, praba kar [EMAIL PROTECTED] wrote:
  What why it is more efficient.  Kindly let me
  know with some details.

 Have you read _any_ of the thread?  A number of people have
 already explained in detail why programming in Pything is more
 efficient.   Please read the responses you've already gotten.

Grant,

Going by the Google Groups timestamps that I see, there's a good chance
that none of the other responses were visible to the OP when the above
followup was posted.

-- 
Ben Sizer

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doubt C and Python

2005-08-25 Thread michael
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


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doubt C and Python

2005-08-25 Thread Uwe Schmitt
 
 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.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doubt C and Python

2005-08-25 Thread Grant Edwards
On 2005-08-25, Ben Sizer [EMAIL PROTECTED] wrote:
 Grant Edwards wrote:
 On 2005-08-23, praba kar [EMAIL PROTECTED] wrote:
  What why it is more efficient.  Kindly let me
  know with some details.

 Have you read _any_ of the thread?  A number of people have
 already explained in detail why programming in Pything is more
 efficient.   Please read the responses you've already gotten.

 Grant,

 Going by the Google Groups timestamps that I see, there's a good chance
 that none of the other responses were visible to the OP when the above
 followup was posted.

You're probably right.  

Google groups may be The End of Usenet as We Know It.

-- 
Grant Edwards   grante Yow!  Are we on STRIKE yet?
  at   
   visi.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doubt C and Python

2005-08-24 Thread praba kar

--- James [EMAIL PROTECTED] wrote:

  Some people with C background use Python instead
  of  programming in C.why?
 
 Becuase it is much more efficient.
 
 -James

What why it is more efficient.  Kindly let me
know with some details.

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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doubt C and Python

2005-08-24 Thread Grant Edwards
On 2005-08-23, praba kar [EMAIL PROTECTED] wrote:

 Some people with C background use Python instead of
 programming in C.why?
 
 Becuase it is much more efficient.
 
 -James

 What why it is more efficient.  Kindly let me
 know with some details.

Have you read _any_ of the thread?  A number of people have
already explained in detail why programming in Pything is more
efficient.   Please read the responses you've already gotten.

-- 
Grant Edwards   grante Yow!  My DIGITAL WATCH
  at   has an automatic SNOOZE
   visi.comFEATURE!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Doubt C and Python

2005-08-23 Thread 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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doubt C and Python

2005-08-23 Thread James
 Some people with C background use Python instead
 of  programming in C.why?

Becuase it is much more efficient.

-James

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doubt C and Python

2005-08-23 Thread 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
-- 
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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doubt C and Python

2005-08-23 Thread Will McGugan
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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doubt C and Python

2005-08-23 Thread Jeff Schwab
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.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doubt C and Python

2005-08-23 Thread en.karpachov
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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doubt C and Python

2005-08-23 Thread Grant Edwards
On 2005-08-23, praba kar [EMAIL PROTECTED] 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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doubt C and Python

2005-08-23 Thread Wouter van Ooijen (www.voti.nl)
   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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doubt C and Python

2005-08-23 Thread Wouter van Ooijen (www.voti.nl)
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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doubt C and Python

2005-08-23 Thread Terry Hancock
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

-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Doubt C and Python

2005-08-23 Thread Delaney, Timothy (Tim)
Terry Hancock wrote:

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

More importantly IMO is that humans cannot effectively optimise code
without profiling - and compilers are not very good at optimising poor
algorithms either. Humans are *really* bad at guessing where bottlenecks
are.

I had a case recently where the *major* performance bottleneck in a
(Java) system was ... equals() and hashCode(). These objects were being
used in lots of hash maps and similar things. The absolute best
performance improvement I was able to make was to cache the hash code,
and reduce the number of times that the expensive parts of the equals()
comparison were called.

It's a lot easier to refactor sub-optimal code in Python than in most
other languages. This is tied directly to the fact that it's easier (and
shorter) to express many concepts/algorithms in Python than in other
languages. This further contributes to it being more fun to code in
Python.

Tim Delaney
-- 
http://mail.python.org/mailman/listinfo/python-list