Why learn Python ??

J

John J. Lee

Jacek Generowicz said:
If you want to perform miracles, then learn Lisp. If you
merely want to write programs that rock, then learn Python.
[...]

....and then somebody argues that macros aren't a programming language
feature, but a harmful means of inventing new languages, and then we
get into that endless macro thread again...


John
 
J

John J. Lee

Derek said:
All I know is that there are thousands of extremely large projects
written in C++, some consisting of millions of lines of code written
by hundreds of developers. C++, while far from perfect, has proven
its worth on a huge scale. Python, at the very least, has yet to do
so.

See a recent thread here listing some fairly large Python projects.

Of course, taking lines of code at face value is rather like talking
about waiting lists instead of waiting times...


John
 
J

John J. Lee

Bicho Verde said:
I have some basic skills in programming (C, Pascal, Macromedia
Actionscript) but don't know exactly what to do in the world of programming.

If you just want to motivate yourself for some semi-arbitrary project,
my advice is to start using some open-source software. All software
sucks, so you'll eventually find something that pisses you off enough
to make you want to fix it or do it from scratch, properly :)

And also I don't know exactly why would I learn Python rather than C#,
C++ or Perl.

They are all very different languages. Trawl through google groups --
comp.lang.python is a great place to look for comments on all three
(but I would say that). Try some of Alex Martelli's posts. I used to
default to the widely-held position that "language wars" are mostly
content-free "religious" arguments, but experience has taught me
otherwise. There are big, important, differences in programmer
efficiency, in computer-resource efficiency, and in community support.
And, to some extent, in the ways they make you think about problems.

The issues are subtle and complicated, and understanding them requires
writing programs in a set of languages diverse enough to come
somewhere vaguely close to spanning the big space of language-design
possibilities.

I'm feeling particularly self-indulgent, so here are a bunch that seem
notable current players to me:

Python: All-round pragmatic winner, and elegant to boot. One
disadvantage: you'll struggle to motivate yourself to learn any other
language once you've used it ;-)

Perl: CPAN is great; the language is merely an insane version of Python
(yes, Perl does predate Python).

C++: No compromises on execution speed; plays well with C (and with
Python: check out Boost Python); horrendously complicated; no garbage
collector (unless you add one yourself, but then you'd be better off
mixing C++ with a saner language). Notable for "templates".

C: Needs no introduction!

Java: Solid security model; piles of code; shockingly mediocre language,
to the extent that there would be precious few sane uses of the thing
were it not for Jython and all those libraries (but watch out for over-
engineering).

C#: Java for MS .NET users (to first order, anyway). .NET has broader
goals than Java for language interoperation, so even though Jim Hugunin
and others have done some initial work on a .NET implementation of
Python, dynamic languages like Python will likely never be full .NET
citizens (thanks to the design of the .NET CLR). If that full
citizenship is important to you, C# has that advantage, but I'm
reliably informed it's fairly well-described as "a Java clone"
(implying programmer-inefficiency), so I'd be inclined to look for a
better language with a good .NET implementation. Lisp? Smalltalk?
(there was talk of an excellent .NET smalltalk implementation, but I'm
not sure whether that was vapourware or not...)

O'Caml: Excellent execution speed without C/C++'s unpleasant bugs.
Functional (in the technical sense), with elegant static type
inference, but multi-paradigm: you can write procedural code too.
Requires a different way of thinking to procedural languages for best
use. Nasty syntax. O'Reilly book in English and French.

Haskell: Another functional language (like O'Caml); good for forcing you
to think functionally; lazy evaluation. Lots of good books.

Fortran: Still rules for some numerical analysis work.

Lisp: Powerful, elegant and well-established, but it has been argued
(see recent threads here) that Lisp macros are not best described as a
language feature, but rather as a harmful, Babel-inducing, tool for
making new languages.

Scheme: Cleaned-up version of Lisp. Beautifully simple. Suffers from a
splintering of the user community thanks to a multitude of subtly
different implementations. Worth learning just to read Abelsson &
Sussman's (sp?) freely-downloadable book "Structure and Interpretation
of Computer Programs".

Eiffel: Design by contract. The book to read is Meyer's "Object-
Oriented Software Construction". Full of interesting stuff, if you can
stand his self-importance ;-).

Lua: Pint-sized Python.

Erlang: Concurrent programming.

Ruby: Python with a smaller user community (unless you're Japanese),
some minor wins and losses, and a very questionable design decision or
two thrown in (see numerous threads on this group).

Smalltalk: Never tried it, but sounds interesting, and similar to Python
in some ways.

Oz: Prolog for the 21st century (OK, I admit I haven't a clue what it's
like really, but I have to try it some day...).

Mathematica and Maple: Heaven, if you're into maths.

Alex Martelli has pointed out the brain-stretching value of learning
languages of a different nature (some of which aren't Turing
complete): including query languages (eg. SQL) and markup languages
(eg. XML).

Everybody here will tell you this, but I'm going to say it yet again:
don't be so foolish as to think you have to write *all* your code in a
language like C++ (or C, or Fortran, depending on the use) just
because you want the program as a whole to run fast.

And take the current myopic view of static typing (in the eyes of the
great unwashed programming public) with a bucket of salt.

Basicaly I don't know where to start, if there is much to do or
if it is has it seems and there is software to everything nowadays and so
doesn't make sense to spend time in learning a programming language.

I just have this idea that I would like to contribute to the curve of
accelarated exponential progress (technological singularity), artificial
intelligence and so on. From that point of view there is much to do... But

You should be able to get that lot done in a weekend, no? <wink>

Really, if you buy the notion of a technological singularity, you've
got me well-and-truly puzzled as to how you fit that into your brain
at the same time as believing that "there is software to everything
[sic] nowadays"!

can I stand for it and where to start?

Small?... and, of course, keep your eyes peeled for something you
think really matters.


John
 
R

Rick Muller

Bicho Verde said:
And also I don't know exactly why would I learn Python rather than C#,
C++ or Perl.

I'd like to take a slightly different perspective on why you should
learn Python: it's simply more fun that the other languages. I know
lots of programming languages, and many are useful, but python is the
only language that I actually look forward to programming in. There is
a real elegance to the syntax, and, once you get used to the whole
indenting thing, you can use python as a pseudocode or an outlining
language. The more you enjoy a language, the more you will use it, and
the better you will be at it.
 
D

Donn Cave

Paul Rubin said:
C++ was motivated by the problems faced by big projects written in C.
I'm talking about stuff like telephone switches with hundreds of
programmers and millions of lines of code. Even with very competent
designers and managers, those projects usually ran amuck. C++ gives
some real help in keeping projects like that functioning, if the
programmers and managers know what they're doing. If they don't know
what they're doing (as is the case in most projects), C++ isn't that
likely to help and may make the problems worse.

Hm, to me this proposition seems too self-reliant. If the
designers and managers fail to thrive on C++, then Q.E.D. -
must not have known what they were doing.

At any rate, as you note, there are other languages such as
Java that may or may not (can't say from experience) offer
some or all of the benefits without the worst problems. Your
telephone switch example reminds me to mention Erlang, which
is by no means an attempt to offer any of C++'s features but
seems to work in that space.

I don't know if we're on very solid ground from which to laugh
at C++, though. Python has the advantage of a clean start, but
from a software engineering standpoint it really seems like a
hacker language. Full of neat tricks that work like magic, but
does it really even attempt to offer anything in the area you're
talking about?

If so, that might be a good direction for yet another book about
Python.

Donn Cave, (e-mail address removed)
 
A

Anton Vredegoor

Bicho Verde said:
I just have this idea that I would like to contribute to the curve of
accelarated exponential progress (technological singularity), artificial
intelligence and so on. From that point of view there is much to do... But
can I stand for it and where to start?
Anyone would help me and give me some hints?

http://www.nickbostrom.com

Anton
 
C

Cameron Laird

.
[pages of marvelously
precise analysis]
.
.
Eiffel: Design by contract. The book to read is Meyer's "Object-
Oriented Software Construction". Full of interesting stuff, if you can
stand his self-importance ;-).
.
.
.
Mostly I'm writing just to applaud--this post had a lot
of value to it. The largest quibble I could find in its
scores of lines was the failure to mention that *OOSC*
is valuable reading for OO programmers working in *any*
language, not just Eiffel. *OOSC* is like *SICP* in
that regards; it towers not just over the competition,
but also any apparent limit imposed by its language of
expression.
 
C

Cameron Laird

.
.
.
If so, that might be a good direction for yet another book about
Python.

Donn Cave, (e-mail address removed)

I sure think so; if only I were a man of leisure, writing *Programming
in the Large with Python* would be verrrrrry tempting.
 
P

Paul Rubin

Donn Cave said:
I don't know if we're on very solid ground from which to laugh at
C++, though. Python has the advantage of a clean start, but from a
software engineering standpoint it really seems like a hacker
language. Full of neat tricks that work like magic, but does it
really even attempt to offer anything in the area you're talking about?

It makes some feeble ones but is somewhat hobbled by its origins as a
scripting or "glue" language. Also, Python is really still in its
infancy. Maybe after PyPy is completed, someone can try writing a
serious compiler for it, and the issues brought out by writing the
compiler can drive the design of a successor language, Python II or
whatever.

The one attempt I know of to write a substantial Python application
competitive with similar applications written in C was the Grail web
browser, and AFAIK that was a complete failure. However, for small to
medium sized projects which don't have to run fast, Python is great.
 
D

Donn Cave

Quoth Paul Rubin <http://[email protected]>:
....
| The one attempt I know of to write a substantial Python application
| competitive with similar applications written in C was the Grail web
| browser, and AFAIK that was a complete failure. However, for small to
| medium sized projects which don't have to run fast, Python is great.

Well, egads. Grail is a Python/Tcl/Tk hybrid, and I think one
of the problems with that it complicates the optimization phase.
Plus the official objective never did seem to be to compete with
similar applications, rather they would say they were primarily
writing a document viewing tool for CRNI and it was just a coincidence
that it happened to be a nice web browser. Was a bit slow, but did
have some nice touches.

But at any rate, I thought we were talking about huge projects
involving many programmers, and I don't think Grail was of that
sort at all. I don't know what kind of programmer resources were
allocated to it, but I bet it was actually a smashing success in
those terms. As for its size, I'd have to look, I have the code
around somewhere, but I'd guess it was smaller than Mailman or Zope.
Small enough that one programmer could become pretty thoroughly
acquainted with the whole thing.

Donn Cave, (e-mail address removed)
 
J

Jacek Generowicz

Jacek Generowicz said:
If you want to perform miracles, then learn Lisp. If you
merely want to write programs that rock, then learn Python.
[...]

...and then somebody argues that macros aren't a programming language
feature, but a harmful means of inventing new languages, and then we
get into that endless macro thread again...

Well they're all Nazis.
 
J

Jacek Generowicz's alter ego

Jacek Generowicz said:
Jacek Generowicz said:
If you want to perform miracles, then learn Lisp. If you
merely want to write programs that rock, then learn Python.
[...]

...and then somebody argues that macros aren't a programming language
feature, but a harmful means of inventing new languages, and then we
get into that endless macro thread again...

Well they're all Nazis.

Godwin's Law !

You lose !

Nah na-na naaa nah !

Game over.

(And I'll predend I've never heard of Quirk's Exception, so I'm outa
here.)
 
J

Jacek Generowicz

Samuel Walters said:
because there seem to be many more introductory tutorials and a lot of
advice that one should learn Scheme, then move to Common Lisp.

Careful. If you were to make such a suggestion on comp.lang.lisp, then
you'd be likely to be told that learning Scheme first will cause you
irreversible brain damage. Of course, now that He Whose Name Must Not
Be Mentioned is no longer posting there, the words which will be used
to point this out will probably be less colourful.

:)
 
M

Michele Simionato

Samuel Walters said:
Lisp/Scheme:
Lisp and Scheme are two languages that people claim will give you
Jedi-like powers as a programmer. I'm learning them right now, so I can't
give you advice on why one would learn them.

I can think of two situations:

1. You want to learn more about programming.
2: You want to implement your own programming language.

About 1: Lisp/Scheme are traditionally at the frontier of the research
in programming languages, so they have everything (Common Lisp) or
you can easily implement everything (Scheme). So, when you have learned
Lisp/Scheme, you have learned nearly every concepts in programming.
This is the reason why (IMHO opinion) you should not try to learn them
as first languages, especially Common Lisp. It is too difficult.
Learn Python first!

About 2: if you want to implement a programming language, it is much
easier to write it on top of Lisp/Scheme (thanks to the macro facility)
than to write it from scratch. Of, course, if you want performance,
you would implement it in C, but still Lisp/Scheme can be useful to
prototype it.

Apart for these two situations, I would stay with Python. Just my 2 eurocents,

Michele
 
G

Graham Dumpleton

.
.
.
.
.
.
And if you *are* working on a big multi-person project, and you
choose C++, you're likely to end up with ... a big mess.

I get to say so. I'm fond of C++, and have seen plenty of pro-
jects which rely on it. I've also seen the teams assigned to
such projects ...

Would agree that more often than not it is the programmers working
on the project. I have met very very few programmers who I thought
had what it takes to develop decent C++ code which is understandable
and maintainable. Part of the problem though is not the programmers
but the C++ libraries they have to work with. Even though the
STL may be the "standard template library", it is pretty dangerous stuff.
Your average programmer however will tell you it is wonderful stuff
and never understand its danger and how one can so easily create
huge disasters with it. Part of the utility of Python is thus not so much
the language itself, but the availability of useful modules to go with
it. I wouldn't say all the Python modules are perfect, some could
certainly have done with a bit more thought, but it certainly gives
a Python programmer a head start over a C++ programmer.
 
B

Bruno Desthuilliers

Samuel said:
|Thus Spake Bicho Verde On the now historical date of Mon, 12 Jan 2004
13:05:19 +0000|

I have now free time and money to do what I want :)

Go to the Bahamas. You'll enjoy it more.

[chop]

Anyone would help me and give me some hints?


Here's my two cents on which languages to learn, why and in what order.
(snip)

Perl:
I don't like perl, but you shouldn't judge a language on my opinion of it.
Perl is very popular and is worthy understanding the basics of. Even if
you don't like it, learn enough of it to read programs written in it.

<troll>
Woops ! The problem with Perl is actually that it's more or less a
write-only language !-)
</troll>

Bruno
 
M

Michael Hudson

.
[pages of marvelously
precise analysis]
.
.
Eiffel: Design by contract. The book to read is Meyer's "Object-
Oriented Software Construction". Full of interesting stuff, if you can
stand his self-importance ;-).
.
.
.
Mostly I'm writing just to applaud--this post had a lot
of value to it. The largest quibble I could find in its
scores of lines was the failure to mention that *OOSC*
is valuable reading for OO programmers working in *any*
language, not just Eiffel. *OOSC* is like *SICP* in
that regards; it towers not just over the competition,
but also any apparent limit imposed by its language of
expression.

I would also say that OOSC is one of those books that's at least as
interesting when it's *wrong* than when it's right.

Cheers,
mwh
 
M

Michael Hudson

Jacek Generowicz's alter ego said:
Jacek Generowicz said:
[...]
If you want to perform miracles, then learn Lisp. If you
merely want to write programs that rock, then learn Python.
[...]

...and then somebody argues that macros aren't a programming language
feature, but a harmful means of inventing new languages, and then we
get into that endless macro thread again...

Well they're all Nazis.

Godwin's Law !

I believe Godwin's Law was meant to be descriptive, not prescriptive.
HAND.

Cheers,
mwh
 
D

David M. Cook

I have now free time and money to do what I want :)
I have some basic skills in programming (C, Pascal, Macromedia
Actionscript) but don't know exactly what to do in the world of programming.
And also I don't know exactly why would I learn Python rather than C#,
C++ or Perl. Basicaly I don't know where to start, if there is much to do or

You could casually pick up enough Python to be useful in a week or so of
evenings.

Perl is not much harder, but has a lot of "gotchas". I think Perl is more
natural as a system administration language, though, as that is what it was
designed for.

The others require much more up-front study before one can start writing
useful programs. C#/Java are much easier than C++, but have huge, complex
APIs (my experience here is with Java, not C#) and require a lot of
boilerplate to get things done.

http://www.ferg.org/projects/python_java_side-by-side.html
if it is has it seems and there is software to everything nowadays and so
doesn't make sense to spend time in learning a programming language.

This is where the ease of writing "one off" Python programs comes in. When
you do find yourself needing to write some custom code, you'll find it very
easy to cobble together something useful quickly.

Dave Cook
 
D

Derek

John J. Lee said:
[...]
All I know is that there are thousands of extremely large
projects written in C++, some consisting of millions of
lines of code written by hundreds of developers. C++,
while far from perfect, has proven its worth on a huge
scale. Python, at the very least, has yet to do so.

See a recent thread here listing some fairly large Python
projects.

Of course, taking lines of code at face value is rather like
talking about waiting lists instead of waiting times...

Point taken. I once worked on a project where we implemented a
production system in C++ and then implemented it again in Python for
QA purposes. It took about 150k lines of C++ code and 10k lines of
Python. Python took less code because so many modules are bundled
with the language, but the C++ system ran many times faster. It's all
about picking the right tool for the job.
 

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
474,176
Messages
2,570,949
Members
47,500
Latest member
ArianneJsb

Latest Threads

Top