467,075 Members | 1,078 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,075 developers. It's quick & easy.

Why would I learn Python over other languages?

Okay, here's what I know so far about Python:
It's an object-oriented scripting language, supported on many platforms.

Now here are my questions:
It is easy to learn?
Does it support GUI programming?
Does it support server-side programming, say for web apps?
Does it have extensions and libraries, say for DB connectivity, serial com
or network programming...?
Can it be used for administrative tasks, say as perl...?
Also, can it be compiled to native code?

Also much appreciated would be simple comparisons with say JAVA (my other
candidate), and pointers to sites and docs where to start.

Thank you in advance.

--
charif
Jul 18 '05 #1
  • viewed: 2170
Share:
24 Replies
On 2004-07-08, Charif Lakchiri <ch****@kuc.biglobe.ne.jp> wrote:
It is easy to learn?
Yes. Of all the languages I've looked at Python's been one of the
easiest.
Does it support GUI programming?
Yes; in several different flavors. TK, QT, GTK just to name 3.
Does it support server-side programming, say for web apps?
Yes. mod-python and zope come to mind.
Does it have extensions and libraries, say for DB connectivity, serial com
or network programming...?
Yes. Standard, in fact.
Can it be used for administrative tasks, say as perl...?
Yes. I Python has replaced Perl for my admin tasks since I find Python
far more maintainable than Perl in the long run.
Also, can it be compiled to native code?


No. However on i386 there is Psyco which provides some impressive speed
boosts.

--
Steve C. Lamb | I'm your priest, I'm your shrink, I'm your
PGP Key: 8B6E99C5 | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------
Jul 18 '05 #2
I was ready to write a long response, but then I realized that all you
probably need to know is speed. As in, how fast can I learn this?

Java will take you months to get good, years if you don't know any other
languages yet. It will take books, large time investments, lots of
busywork as you get comfortable with stuff, and lots of false starts as
you discover new parts of the API. You can be good at Python in weeks.

The Java API dwarfs anything else I know. There are literally thousands
of classes. I know the API well enough to make experienced programmers
go "Woah! I never knew Java could do that!" and I still sometimes find
it easier to write my own stuff than go looking for it in the docs. It's
intimidating to newcomers, and it should be. It's pretty clean, but it's
vast beyond any one person's ability to grasp.

Python can do everything Java can do, but you can eyeball the whole
module list every time you're trying to figure something out. It's
easier to try stuff as you go (interactive interpreter), and a lot of
the busywork and toil has been rolled into language features that make
it trivial. That ultimately makes everything less work and more fun.

To put it in perspective, I learned Java 3 years before Python. It was
my language of choice. It took me two weekends with Python before I was
more productive with it than with Java.
Jul 18 '05 #3
"Charif Lakchiri" <ch****@kuc.biglobe.ne.jp> writes:
Now here are my questions:
It is easy to learn?
For the most part I'd say yes.
Does it support GUI programming?
Hmm, yes, although the official GUI toolkit (tkinter) is cumbersome,
doesn't look so great on the screen, and is poorly documented.
Does it support server-side programming, say for web apps?
There's a cgi module. There's various third party packages for fancier
types of web apps.
Does it have extensions and libraries, say for DB connectivity,
serial com or network programming...?
There are reasonably good libraries included for various network protocols.
There are third party extensions for DB connectivity and serial com.
Can it be used for administrative tasks, say as perl...?
Sure, so can any language. I'd say it's generally simpler to toss off
a 5-line perl script for some admin task than a comparable Python
script. Python is better for somewhat more complex tasks, where Perl
programs start getting hopelessly disorganized.
Also, can it be compiled to native code?
There's a JIT compiler called psyco which isn't yet officially part of
Python but which is coming along nicely. There's no ahead-of-time
native code compiler and the language doesn't lend itself very well to
that.
Also much appreciated would be simple comparisons with say JAVA (my other
candidate), and pointers to sites and docs where to start.


www.python.org
Jul 18 '05 #4
Paul Rubin wrote:
"Charif Lakchiri" <ch****@kuc.biglobe.ne.jp> writes:[snip] [snip]
Does it support GUI programming?


Sorry: I couldn't resist:
Hmm, yes, although the official GUI toolkit (tkinter) is cumbersome,
Obviously depends on who's talking: I personnaly always found *other* GUI
toolkits cumbersome (I've tested wxPython and PyQT)
doesn't look so great on the screen,
It seems to be the general opinion, but there is some work to make it better on
the tcl/tk side; see http://tcl.projectforum.com/tk/Home
and is poorly documented.


No it isn't; there are a lot of Tkinter resources around, not to mention plain
tk ones. I do agree that they may be hard to find, but they exist. The docs for
the other toolkits I've tried were usually worse than the ones for Tkinter
(things may have improved for wxPython, since I tested it quite a while ago)
--
- Eric Brunel <eric (underscore) brunel (at) despammed (dot) com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com

Jul 18 '05 #5
On 08 Jul 2004 00:04:51 -0700, Paul Rubin
<http://ph****@NOSPAM.invalid> wrote:
Does it support GUI programming?


Hmm, yes, although the official GUI toolkit (tkinter) is cumbersome,
doesn't look so great on the screen, and is poorly documented.


I won't dispute the other points but Tkinter is better documented
than any other Python GUI toolkit IMHO. Not only does it have the
Pythonware web site, it also has a book by Grayson and all the
Tcl/Tk documentation(books and web sites)

I'd argue that the amount of documentation for Tk (and thus
Tkinter) exceeds any GUI tookit other than X or Microsoft's
various efforts.

Picking nits,

Alan G.

Author of the Learn to Program website
http://www.freenetpages.co.uk/hp/alan.gauld
Jul 18 '05 #6
Charif Lakchiri wrote:
Does it support server-side programming, say for web apps?
Does it have extensions and libraries, say for DB connectivity, serial com
or network programming...?


Check out the twisted package (http://www.twistedmatrix.com/) for an
incredibly powerful answer to these two questions.

---
Ed Suominen * http://www.eepatents.com
Registered Patent Agent * Open-Source Software Author (yes, both...)

Jul 18 '05 #7
"Charif Lakchiri" <ch****@kuc.biglobe.ne.jp> wrote:
It is easy to learn?
Yes. Simplicity and ease of learning were major design criteria. There
is also a large and active user community who can provide help,
guidance, and the occasional group hug.
Does it support GUI programming?
Yes. There are several GUI libraries available. I don't do much GUI
programming, so I'll leave it to others to describe those.
Does it support server-side programming, say for web apps?
Yes. There are a variety of ways to do this. At the low-level, there's
CGI module. There's a mod-python for Apache. There's a sample HTTP
server that comes with the system which you can extend on your own. I
recently saw mention of a JSP container for writing servlets in Python.
Does it have extensions and libraries, say for DB connectivity, serial com
or network programming...?
Yes. There is a standard DB API, and adapters for all of the major
databases (Oracle, Sybase, MySql, etc).
Can it be used for administrative tasks, say as perl...?
Yes. There are modules for interacting with the file system and
operating system (process control, etc). If you want, you can execute
external commands and capture their output, just like popen in perl.
Also, can it be compiled to native code?
Yes. The compiler is called "psyco", and it's very easy to use.
Also much appreciated would be simple comparisons with say JAVA (my other
candidate), and pointers to sites and docs where to start.


A quick Java. vs. Python comparison:

Java uses a C-like syntax, Python uses it's own. The Python syntax is
very easy to learn.

Java uses static typing, Python uses dynamic typing That means Java
programs are full of typecasts and variable declarations and useless
drek like that. On the other hand, since you've pushed a lot of
checking off to run time, Python takes a performance penalty.

Java is very much into data hiding, with private/protected/public
keywords to declare classes and variables. In Python, everything is
public by default. There are some ways to do weak data hiding if you
want.

Both compile to byte-code which runs on a virtual machine. The
underlying VM's are similar enough that there is a version of Python
which compiles to java byte code and runs on a JVM! One big difference
is that the compile step is explicit in Java, but happens automatically
and behind the scenes in Python. This means you can just fire up an
interactive Python session and type code at it to try things out, which
turns out to be incredibly useful.

Both are object-oriented. Java is a bit more extreme in this philosophy
(i.e. everything is a class). In Python, you can write non-OO code if
you want, and that's often easier for quickie one-off scripts such as
are common in sysadmin work.

If you are just starting out, I would definately learn both.
Jul 18 '05 #8
On Thu, 8 Jul 2004, Eric Brunel wrote:
Paul Rubin wrote:
Hmm, yes, although the official GUI toolkit (tkinter) is cumbersome,


Obviously depends on who's talking: I personnaly always found *other* GUI
toolkits cumbersome (I've tested wxPython and PyQT)


Seconded. Only in Tkitner can you write a (legible) one-liner Hello World:

import Tkinter
Tkinter.Label(text='Hello, world!').pack()
doesn't look so great on the screen,


It seems to be the general opinion, but there is some work to make it better on
the tcl/tk side; see http://tcl.projectforum.com/tk/Home


On Win32, Tk uses the native widgets, so it looks just as pretty (?) as
any other Win32 app.
and is poorly documented.


No it isn't;


Also seconded. It's also a lot easier to follow Tk's Tcl documentation
than GTK or Qt's C documentation.

Jul 18 '05 #9
On Thu, 08 Jul 2004 06:10:32 GMT, Anthony Roberts <ac*************************@ucalgary.ca> wrote:
I was ready to write a long response, but then I realized that all you
probably need to know is speed. As in, how fast can I learn this?

Java will take you months to get good, years if you don't know any other
languages yet. It will take books, large time investments, lots of
busywork as you get comfortable with stuff, and lots of false starts as
you discover new parts of the API. You can be good at Python in weeks.

The Java API dwarfs anything else I know. There are literally thousands
of classes. I know the API well enough to make experienced programmers
go "Woah! I never knew Java could do that!" and I still sometimes find
it easier to write my own stuff than go looking for it in the docs. It's
intimidating to newcomers, and it should be. It's pretty clean, but it's
vast beyond any one person's ability to grasp.

Python can do everything Java can do, but you can eyeball the whole
module list every time you're trying to figure something out.


I find that Python's library does as much as Java's but with less
classes. python's libraryu focusses on gettinbg the job done,
whereas I find java's library to be pedantic and irritating.
--
"It's easier to find people online who openly support the KKK
than people who openly support the RIAA" -- comment on Wikipedia
(Email: zen19725 at zen dot co dot uk)
Jul 18 '05 #10
Christopher T King wrote:
Also seconded. It's also a lot easier to follow Tk's Tcl documentation
than GTK or Qt's C documentation.


Also GTK documentation is not so bad, I prefer GTK but is only my personal
taste -.-

--
Liquid
sl.kuht.it <-> www.kuht.it
Jul 18 '05 #11
On Thu, 08 Jul 2004 06:10:32 GMT, Anthony Roberts <ac*************************@ucalgary.ca> wrote:
I was ready to write a long response, but then I realized that all you
probably need to know is speed. As in, how fast can I learn this?

Java will take you months to get good, years if you don't know any other
languages yet. It will take books, large time investments, lots of
busywork as you get comfortable with stuff, and lots of false starts as
you discover new parts of the API. You can be good at Python in weeks. .... To put it in perspective, I learned Java 3 years before Python. It was
my language of choice. It took me two weekends with Python before I was
more productive with it than with Java.


I second that. The thing I find remarkable about Python is precisely that:
that learning the language is a very small investment.

Just sit down over the weekend with docs.python.org, a Python installation
and a text editor with good Python support. By Monday you may not need to
make a decision ...

/Jorgen

--
// Jorgen Grahn <jgrahn@ ''If All Men Were Brothers,
\X/ algonet.se> Would You Let One Marry Your Sister?''
Jul 18 '05 #12
I used to work with a guy who was a Perl fanatic (Hi, Nathan). We
parted company a year to two ago, but I still talk to him every once in
a while.

A few days ago, I got some mail from him that said:
I just wanted to drop you a quick line to thank you for being the Python
evangelist at XXXX. I've started a small programming project this week
and I decided to prototype it in an interpreted language. Thus, this is
my first week working with Python! I've still got tons to learn but it
is very clean and I really like the ability to test code fragments
interactively.
and later:
So far I've been quite pleased by the amount and quality of
documentation available on the Internet. I hate to say it, but it's
more readable than Perl (the code and the docs).


I know this sounds like one of those corny fake testimonials, but those
are real cut-and-paste quotes from his email. I just can't imagine
reading the above paragraphs with "Python" crossed out and "Java"
written in with crayon.
Jul 18 '05 #13
Charif Lakchiri a écrit :
Okay, here's what I know so far about Python:
It's an object-oriented right, but also imperative and a bit functional
scripting yes with 'scripting'='dynamic hi-level interpreted'
language, supported on many platforms. right
Now here are my questions:
It is easy to learn? Yes. It's (also) used as scripting language for non-programmers and as
first-language for students. If you have some working experience as a
programmer, being productive in Python is a matter of days.
Does it support GUI programming? Yes. TCL, QT, GTK, wxWidget, Win32, etc...
Does it support server-side programming, say for web apps? Yes. The killer Python-app is Zope, a web application server - and it's
*really* a killer-app. But there are many other solutions (plain old
cgi, mod_python, a lot of frameworks based upon mod_python, etc...)
Does it have extensions and libraries, say for DB connectivity, serial com
or network programming...? Everything you need, and much more. Ever wrote a web server in a pair of
lines of code ?
http://docs.python.org/lib/module-SimpleHTTPServer.html
Can it be used for administrative tasks, say as perl...? Of course.
Also, can it be compiled to native code? No. Why ?

But have a look at swig, Psycho, and Pyrex if you feel concerned with
raw speed...
Also much appreciated would be simple comparisons with say JAVA (my other
candidate),
Reading a text file line by line and printing each line to stdout in java:

import java.io.*

public class ReadFile {
public static void main(String[] args) {
try {
BufferedReader buff =
new BufferedReader(new FileReader("mytext.txt"));
String line = buff.readLine();
while (line != null) {
System.out.printLn(line);
line = buff.readline();
}
}
buff.close();
catch (IOException e) {
System.out.printLn("Erreur : " + e.toString());
}
}
}

The same in Python

try:
for line in File("mytext.txt"):
print line
except IOError, e:
print "Erreur", e

The exception handling being useless in such a context (but still
probably mandatory in the Java version...), you can make it :

for line in File("mytext.txt"): print line

If you go for low-level programming in an interpreted language, choose
Java. If you prefer fun and productivity, you know where to find it.

Consider this : starting from scratch in both languages, you'll probably
have your application up and running in Python way before you begin to
figure out how to write it with Java.

Consider this too : There is a Java implementation of Python. So you can
have you'r cake and eat it too. (well, almost, since you'll still have
to learn the Java API, but what...)
and pointers to sites and docs where to start.
http://www.python.org
Thank you in advance.

HTH
Bruno
Jul 18 '05 #14
Hi , I would like to add a comment I agree I uses to be a coder (
Systems Programmer prodominately Java and JSP and thus switched to
SysAdmin role as I wanted to get into Security and add more dimension to
my learning curve with Linux .

I have used Python quite limiting but it done the trick I also found the
books and the user group excellant going back to Java I am to take and
sit my Java 1.4 exam this November 2004 and Im not that prepared and I
don't fancy the investment I know I need to make in order to try and get
a pass .

Java is a rich dynamic language bit from a time and speed point of view
I love Python and as a Zope Admin is execellant tool in order to run
Zope/Plone CMS sites as If you may or not know Zope/Plone/CMF is making
a quite inpact in the Content Management Areana with this being written
in Python.

So ti say it again Python is a great lanaguage I it isn't for me a hugh
time investment .

Cheers

Chuck
Jorgen Grahn wrote:
On Thu, 08 Jul 2004 06:10:32 GMT, Anthony Roberts <ac*************************@ucalgary.ca> wrote:

I was ready to write a long response, but then I realized that all you
probably need to know is speed. As in, how fast can I learn this?

Java will take you months to get good, years if you don't know any other
languages yet. It will take books, large time investments, lots of
busywork as you get comfortable with stuff, and lots of false starts as
you discover new parts of the API. You can be good at Python in weeks.

...

To put it in perspective, I learned Java 3 years before Python. It was
my language of choice. It took me two weekends with Python before I was
more productive with it than with Java.


I second that. The thing I find remarkable about Python is precisely that:
that learning the language is a very small investment.

Just sit down over the weekend with docs.python.org, a Python installation
and a text editor with good Python support. By Monday you may not need to
make a decision ...

/Jorgen


Jul 18 '05 #15
On Thu, 8 Jul 2004 14:06:08 +0900, "Charif Lakchiri"
<ch****@kuc.biglobe.ne.jp> wrote:
Okay, here's what I know so far about Python:
It's an object-oriented scripting language, supported on many platforms.

Now here are my questions:
It is easy to learn?
I, as always, will answer that question differently from most other
answers you will yet.

Depends how much previous programming experience you have. It is
widely reported, and I have no reason to doubt, that people with a
good understanding of programming principles already in place, find
Python easy to learn.

It is widely reported, that Python also is easy to learn as a first
language. Almost exclusively by people who learned their programming
principles elsewhere. They are making a logical conclusion based on
their understanding of the languages strenghts - clean syntax,
readibility, etc.

My position is that the issue is considerably more complex than that.

I can only go by my own experience. Especially when I have seem
nothing substantial contradicting it, other than verbiage.

It seems to me sensible to believe that someone can become a quite
decent, say C++ programmer, by tackling it as a first language, and
sticking with it.

I don't think that is true of Python. I think there is a layer of
Python that one cannot reasonably penetrate without stepping outside
of Python.

One can get started with Python, with Python.

But in the end I don't think Python serves as a fully adequate
introduction to itself.

Art
Does it support GUI programming?
Does it support server-side programming, say for web apps?
Does it have extensions and libraries, say for DB connectivity, serial com
or network programming...?
Can it be used for administrative tasks, say as perl...?
Also, can it be compiled to native code?

Also much appreciated would be simple comparisons with say JAVA (my other
candidate), and pointers to sites and docs where to start.

Thank you in advance.


Jul 18 '05 #16
Arthur wrote:
But in the end I don't think Python serves as a fully adequate
introduction to itself.


I think you might say the same about almost any language.

And yet, many seem to get a good start in programming with,
well, almost any language... (except VB ;-) .

-Peter
Jul 18 '05 #17
On Thu, 08 Jul 2004 22:10:00 -0400, Peter Hansen <pe***@engcorp.com>
wrote:
Arthur wrote:
But in the end I don't think Python serves as a fully adequate
introduction to itself.


I think you might say the same about almost any language.

And yet, many seem to get a good start in programming with,
well, almost any language... (except VB ;-) .


Perhaps of any very high level language.

Guess I am feeling some frustration. Don't see a path to getting
deeper into an understanding of Python without undertaking getting
some handle on C. Mostly intuition at work.

And its not that I need (or expect to be able) to follow the Python C
code.

Python has me addicted me to the interactive prompt as a learning
tool, so was lucky to comae across CH, a C intepreter.

http://www.softintegration.com

New hope.

Art

Jul 18 '05 #18
Quoth Arthur <aj******@optonline.com>:
....
| It seems to me sensible to believe that someone can become a quite
| decent, say C++ programmer, by tackling it as a first language, and
| sticking with it.
|
| I don't think that is true of Python. I think there is a layer of
| Python that one cannot reasonably penetrate without stepping outside
| of Python.

It's odd that you would pick C++ for contrast. I thought it was
nearly universally dismissed as the worst possible way to learn
object oriented programming, to the point that some people suggest
learning a real OOP language like Smalltalk first to inculcate the
basic principles.

I wouldn't claim that Python is particularly easy for pure beginners,
without more than the slim anecdotal evidence I have, but I would
be interested to hear what other sort of language experience you
believe it takes to get the whole story.

In my comment above about Smalltalk and C++, I don't mean to suggest
that Smalltalk helps anyone understand C++. It's just supposed to
present a more focused object oriented programming model, and that
sense of the important principles is what it's about. Of course it's
utterly different from C++ in most respects.

Does Python present some aspect of itself in a confused and incoherent
way? Well, yes, of course - it's a terrible introduction to functional
programming! But it's a terrible functional programming language anyway,
so a Haskell programmer wouldn't have a big advantage here. In fact
there are enough subtle differences in what variables are and so forth,
that Haskell or for that matter almost any other language is going to
be a bit of a liability.

Donn Cave, do**@drizzle.com
Jul 18 '05 #19
Arthur wrote:
...

I don't think that is true of Python. I think there is a layer of
Python that one cannot reasonably penetrate without stepping outside
of Python.

One can get started with Python, with Python.

But in the end I don't think Python serves as a fully adequate
introduction to itself.


In one sense I think that any language is a sufficient introduction to
itself. Given enough time and effort you learn every trick, see every
corner exposed by someone (perhaps someone with a different background
than you) and learn everything there is to possibly know. Sometimes it
is MORE EFFICIENT to step outside the language to learn it but one can
do the whole thing from the inside. It would be a lot easier to learn
physics if we could step outside the universe and experiment with the
rules but we scrape away at it from the inside and figure it out the
hard way. Python is surely simpler to understand than the universe.

In another sense, every language builds on other languages and you will
always feel you are missing something if you know the language but not
the ones it is built upon. A C++ programmer who doesn't understand
assembly language does not know what an function call "really" is (in
terms of its implementation).

Sometimes Python's implementation language leaks through. "Why is it
that way? Because it is in C?" But that is also true for C++. What does
the register keyword mean? Or ask a Lisper what "cdr" means...

I am skeptical that Python is either more or less self-revealing in
these senses than any other language.

Paul Prescod
Jul 18 '05 #20
Paul Rubin <http://ph****@NOSPAM.invalid> wrote in message news:<7x************@ruckus.brouhaha.com>...
"Charif Lakchiri" <ch****@kuc.biglobe.ne.jp> writes:
Can it be used for administrative tasks, say as perl...?


Sure, so can any language. I'd say it's generally simpler to toss off
a 5-line perl script for some admin task than a comparable Python
script.


So if you want to spend your time tossing off you should use perl right? ;-)

Giles
(ignoring potential cross-cultural humour difficulties.)
Jul 18 '05 #21

"bruno modulix" <on***@xiludom.gro> wrote in message
news:40***********************@news.free.fr...

<snip>

The same in Python

try:
for line in File("mytext.txt"):
print line
except IOError, e:
print "Erreur", e

Umm, that won't work. Should be file instead of File.
The exception handling being useless in such a context (but still
probably mandatory in the Java version...), you can make it :

for line in File("mytext.txt"): print line

If you go for low-level programming in an interpreted language, choose
Java. If you prefer fun and productivity, you know where to find it.

Consider this : starting from scratch in both languages, you'll probably
have your application up and running in Python way before you begin to
figure out how to write it with Java.

Consider this too : There is a Java implementation of Python. So you can
have you'r cake and eat it too. (well, almost, since you'll still have
to learn the Java API, but what...)
and pointers to sites and docs where to start.


http://www.python.org
Thank you in advance.

HTH
Bruno


Nick
Jul 18 '05 #22
On Thu, 08 Jul 2004 22:47:54 -0700, Paul Prescod <pa**@prescod.net>
wrote:
Arthur wrote:
...

I don't think that is true of Python. I think there is a layer of
Python that one cannot reasonably penetrate without stepping outside
of Python.

One can get started with Python, with Python.

But in the end I don't think Python serves as a fully adequate
introduction to itself.


In one sense I think that any language is a sufficient introduction to
itself. Given enough time and effort you learn every trick, see every
corner exposed by someone (perhaps someone with a different background
than you) and learn everything there is to possibly know.


Part of the problem here is language, in the words sense of language.

If Python were an early and dominant programming language, the
language used to speak about Python would have evolved differently.
Much of the discussion about Python is in words that don't seem native
to it. So it becomes near impossible to follow discussions about
Python, with only Python background.

And I think more generally, the issue is that one cannot fully
understand a tool like Python without understanding what problem it is
solving.

It is, it seems to me, solving the problem of programming in a lower
level language. From which its language is drawn.

Art

Jul 18 '05 #23
> It seems to me sensible to believe that someone can become a quite
decent, say C++ programmer, by tackling it as a first language, and
sticking with it.

I don't think that is true of Python. I think there is a layer of
Python that one cannot reasonably penetrate without stepping outside
of Python.

One can get started with Python, with Python.

But in the end I don't think Python serves as a fully adequate
introduction to itself.


That's actually a very good point...

Someone without experience writing complex programs in an OO language
(Java is probably best, as much as it pains me to say it) won't be able
to maintain a large project in Python, and someone that's never touched
C won't know enough about the underlying principals to take full
advantage of some aspects of Python. Not the least of which is actually
writing modules for Python in C...

I do think that C++ should be avoided though. Programmers that first
learned Java or C seem to be able to go on to other languages pretty
easily. Even better, Pascal, as it's impossible to write a useful
program without first learning another language.

But all C++ programmers want to know is how they can get the features
they're used to in whatever new language they're presented with.
Jul 18 '05 #24
Nick Smallbone a écrit :
"bruno modulix" <on***@xiludom.gro> wrote in message
news:40***********************@news.free.fr...

<snip>
The same in Python

try:
for line in File("mytext.txt"):
print line
except IOError, e:
print "Erreur", e

Umm, that won't work. Should be file instead of File.

woops ! You're of course right.
Jul 18 '05 #25

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

42 posts views Thread by Bicho Verde | last post: by
8 posts views Thread by Aziz McTang | last post: by
5 posts views Thread by Charles | last post: by
8 posts views Thread by Hermawih | last post: by
34 posts views Thread by pandit | last post: by
9 posts views Thread by Katie Tam | last post: by
65 posts views Thread by Chris Carlen | last post: by
16 posts views Thread by Raxit@MyKavita.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.