473,770 Members | 1,991 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why Python?

I am looking at learning Python, but I would like to know what its
strengths and weaknesses are before I invest much time in learning it. My
first thought is what is it good for programming, however I expect an
answer from the python newsgroup to be something like "everything ". So
maybe a better question is what type of programming projects is Python a
bad choice?

What makes it better or worse than languages like perl, php, delphi, or
c++?

Thanks for your opinions.

Todd.
Jul 18 '05
20 1851
"Rainer Deyke" <ra*****@eldwoo d.com> wrote in message
news:l6C0c.8261 $ko6.195399@att bi_s02...
Ed Murphy wrote:
On Mon, 01 Mar 2004 05:12:48 +0000, Rainer Deyke wrote:
2. Python programs are somewhat difficult to distribute compared to
programs in languages that compile to native code.
How do you figure this one? Something to do with statically linked
libraries? (I'm a Python newbie, but have been programming in general
for almost 20 years, about half of that professionally. )


Basically you have to distribute the Python interpreter along with your
program, since you generally can't rely on the end user having (the

correct version of) Python installed.

Utilities such as py2exe and McMillan Installer make this problem much
simpler. Real-world example: I needed to provide a customer with a *very*
simple HTTP server for centrally serving up a global configuration file. My
prototype was 2 lines of Python code (actual finished version was about 50
lines, including some signal handling), used McInstaller to create a
free-standing distributable .EXE file (that fit on a 3-1/2" floppy!). Very
portable, does not require Python to be installed on the target platform.

-- Paul
Jul 18 '05 #11
> What makes it better or worse than languages like

Python has loads of modules, which are easy to install.

Python has good documentation, with useful examples.
I'm trying to learn Scheme at the moment, to broaden my programming
horizon. I am generally finding it an uphill struggle. Scheme might be
a theoretically better language design, but in Python you can just get
on and do it.

Someone once suggested that the fact that Python had a Benevolent
Dictator For Life is a possible positive on its popularity, and I
think that the suggestion has merit. Effort has been made to make it
accessable to the ordinary programmer.

To give just one example ...

Regular expressions.

MIT Scheme explains its REXP abstraction: "In addition to providing
standard regular-expression support, MIT Scheme also provides the REXP
abstraction. ". But it doesn't give any examples. And I couldn't find
any by Googling, either.

Now look at Python. Section 4.2.1 (Regular Expression Syntax) kindly
reminds us of the regexp syntax - something that MIT does not. Section
4.2.2 and 4.2.6 then goes on to give us some regexp examples.
Python is popular because it tries to be popular. Scheme seems more
academic, with a more "why would you want a GUI anyway?" type
attitude.
Jul 18 '05 #12
In article <10************ *@corp.supernew s.com>,
Robert M. Emmons <Ro********@cs. com> wrote:
Jul 18 '05 #13

"Todd7" <No****@please. com> wrote in message
news:Xn******** *************** ***********@68. 12.19.6...
I am looking at learning Python, but I would like to know what its
strengths and weaknesses are before I invest much time in learning it. My
first thought is what is it good for programming, however I expect an
answer from the python newsgroup to be something like "everything ". So
maybe a better question is what type of programming projects is Python a
bad choice?

What makes it better or worse than languages like perl, php, delphi, or
c++?

Thanks for your opinions.

Todd.



Why NOT Python?
I'm a noob at it, but so far I love it. It's easy to put together a program
pretty quickly using it. Also, even when I have to code something up in, say
C++, I can still put together a prototype in Python first to get a better
understanding of the problem space. (Ya have to "...throw one away..."
anyway, so why not use Python first?)
I know this doesn't _directly_ answer your question, but it does in a way.
WR
Jul 18 '05 #14
> 3. Some other languages make it easier to detect certain classes of errors
in your code. With a few exceptions, errors in Python code can only be
found by actually running the code or by checking by hand.


True maybe, but I would argue that Python is not suseptable to many if
not most of the errors generated and found in say C/C++ coding. You
also have a dramatic code volume reduction which helps too.

There are static code checkers too for python which can help some too.

I personally think that python has it as a whole on debugging -- i.e.
pretty much the lack of a need to do much sophisticated debugging.

It's not clear to me what kind of error that a C compiler can catch
that's difficult to deal with in Python (although I'm sure there are
some). IMHO the whole reason C/C++ has sophisticated debugging tools is
that code debugging in C is a nightmare.

Thanks for the info--I enjoyed your comments and other's replies to them.

Take care.
Rob
Jul 18 '05 #15
Robert M. Emmons wrote:
IMHO the whole reason C/C++ has sophisticated debugging tools is
that code debugging in C is a nightmare.


That's my opinion as well.

One debugging feature that Python doesn't support is "edit-while-debugging" (edit
the function/method) you just debug, something which is possible in VB and VC6,
for example) I think it'd not be *that* hard implementing it. Maybe a Python IDE
vendor will implement it some day.

-- Gerhard

Jul 18 '05 #16
everything

But you were expecting that.

How about

everything in every way in all situations

The bottom line is python is a clear, powerful language that has a
great culture. You have a choice:

1. You want to learn the "perfect" language for each project at hand.
Even if you're good at learning new languages -- as I think I am --
it's still going to take you a while to be idiomatic in the language
instead of, say, programming perl in python.

Not to mention that finding the "perfect" language can take quite some
time for each project. You'll have language advocates on each side of
the issue. Is this project a natural fit for lisp? Oh, no, ruby's much
more practical for this. Yes, but foobar has a package for doing
exactly what you want. Blah, blah...

2. Learn a general-purpose language that can be easily used with many
different paradigms (OO, functional, etc), has a good library set
(network, math, etc), and has a flexible culture. This language should
be reasonably well-known so you can find it widely, can find books on
it, etc.

Some might say that perl 6 will be the epitome of #2, though my opinion
is that perl will manage to implement #1 in a single language.

If you want to go with option #2, python's at the top of the list, in
my opinion.

(Actually, there is a #3: you want to be highly marketable. Depending
on where you want to work, the language de jour is likely to be C++,
Java, or Visual Basic.)
Jul 18 '05 #17
On 2004-03-01 09:02:01 -0500, cl****@lairds.c om (Cameron Laird) said:
In article <10************ *@corp.supernew s.com>,
Robert M. Emmons <Ro********@cs. com> wrote:
.
[apt comments]
.
.
What's not good in python:

* If speed is more important than coding time use C/C++ instead.
* If you want to obscruate your code maybe a compiled langague is better.

Rob


Note the availability of pyobfuscate <URL:
http://www.lysator.liu.se/~astrand/p...s/pyobfuscate/ >.

Myself, in the absence of more details, I advise people for
whom speed is important to work in Python--but be prepared
to combine it with C coding (or even assembler! I've been
experimenting lately ...).


One thing to note is that it is *reasonable* to combine C, C++,
assembly, etc with Python because the Python API is consistent and
understandable, and doesn't require a confusing "precompile r" (though,
Pyrex is a great one).

-bob

Jul 18 '05 #18
Gerhard Häring <gh@ghaering.de > writes:
One debugging feature that Python doesn't support is
"edit-while-debugging" (edit the function/method) you just debug,
something which is possible in VB and VC6, for example)


Sorry ... what do you mean by "edit while debugging" ?

Something like XCode's "fix-n-continue" ?

In other words the ability to redefine a function in a running program
(possibly even before the stack has been unwound after an error (or
breakpoint) was encountered) ?

[Something which has been an inherent part of the language in many
members of the Lisp family for decades, BTW]

If you forget about not unwinding the stack, Python certainly supports
this.

Now, how would one prevent stack unwiding when an exception is raised
.... in order to allow the user to inspect the stack frames navigate
them, redifine any functions, and then allow continuation?

[I guess I could find the answer in the pdb source.]
Jul 18 '05 #19
> Gerhard Häring wrote:
One debugging feature that Python doesn't support is
"edit-while-debugging" (edit the function/method) you
just debug, something which is possible in VB and VC6,
for example)

Jacek Generowicz wrote: Sorry ... what do you mean by "edit while debugging" ?


You can set a breakpoint in a function, and while stopped at that breakpoint
you can edit the code in that same function. Then, you can continue
execution and it will execute your new code.

As much as I dislike C++, Visual Studio's Edit and Continue feature is a
huge benefit. I often write the skeleton of a function, start the program
and trace into the function, and then write the code right there with the
program running, with live data to test while coding.

You can also change the execution pointer while stopped at a breakpoint. So
you can write some code and test it, and then if you want to change the code
and test it again, just move the execution pointer back to the beginning of
your code.

-Mike
Jul 18 '05 #20

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

Similar topics

0
10259
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10038
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9906
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.