Re: [Tutor] Two Newbile Questions: porting drawmap.c, & Python as a lifetime language

2006-07-05 Thread Python
On Tue, 2006-07-04 at 16:37 -0500, [EMAIL PROTECTED] wrote:
> I am seeking opinions from seasoned veterans on the following two
> questions:
> 
You're getting plenty of replies.  Here's a bit more.

You're probably aware that ESRI has adopted Python for scripting with
their applications.

> 1. What's involved in a port of a C program into Python?  (drawmap is 
> offered in a number of linux distributions btw.)

http://ldots.org/pyrex-guide/
pyrex integrates Python and C into a hybrid language that might be
useful for porting existing C code.

> 
> 2. Seeing Python hailed as a good language for learning programming,  
> how do you rate it as a lifetime language? (I can imagine that many
> people have settled into one language for doing the remainder of their
> life's work. If I am pressed, I will choose Perl at this point.)

I think it is easier to learn to write complex applications in Python
than Perl.  Certainly Perl is rich in features and capabilities, but I
find the rules for keeping everything straight are more complex than
Python's and the possibility of uncaught errors in Perl seems much
higher than in Python.  My favorite example of this is:

cat test.pl
if ("abc" == "def") {print "all letters are =\n"};

perl test.pl
all letters are =

)

 
== is the numeric comparison.  The strings are evaluated to numbers and
both are treated as zero. 0 = 0 is true.
"abc" eq "def" will behave as expected.  Python has its own pitfalls,
but I find the Python pitfalls much easier to live with.

Python continues to evolve while preserving backwards compatibility.
Recent additions such as list comprehension, generators, generator
expressions, display a growth and dynamism that I think will continue to
make Python a great choice among programming languages into the future.

(You didn't really think you'd find people on this list urging you to
use Perl.)

-- 
Lloyd Kvam
Venix Corp

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Two Newbile Questions: porting drawmap.c, & Python as a lifetime language

2006-07-05 Thread Alan Gauld
I missed the original post but I'll chip in anyway...

> [EMAIL PROTECTED] wrote:
>> 2. Seeing Python hailed as a good language for learning 
>> programming,  how do you rate it as a lifetime language? (I can 
>> imagine that many people have settled into one language for doing 
>> the remainder of their life's work.

There is no such thing as a lifetime language (unless maybe its COBOL
or Fortran) because lanmguages are conmstantly changing.

When I started programming in the mid 70's I was using BASIC and
Assembler. Then when I went to University (as an adult student) I was
tought Pascal and C. (While there I also came across Smalltalk and
OOP but they weren't part of the core curriculum) After some years
using C (and some Lisp) at work I needed to learn Objective C and
then C++ which became my prime language for about 5 years.
(During all this time my personal projects were being done in
Pascal or Lisp  -- or Tcl which I'd found by accident...).

Nowadays almost all my work is done in either Python,
Pascal (Windows GUIs), Objective C (for my Apple) or Java.
I only use Java while at work - I detest it as a language.
But I've used over 30 languages in total over the years,
some I've forgotten, others I still dabble with (such as Smalltalk
and Lisp).

The language is pretty well irrelevant, you can do almost
anything in almost any language. The important thing is to
understand how to structure code and to lay it out clearly
for ease of maintenance. You can learn almost any new
language in less than a week. Learning all the common idioms
may take a few months.

>> I am pressed, I will choose Perl at this point.)

Perl is just too lmited in scale for my purposes, it's great for
small scripts and up to a thousand lines or so of code.
But I had to maintain a 5000 line Perl program (ie quite small)
and it was not much fun - too many different styles used
and inconsistent design patterns, something Perl actively
encourages.

Once you get to large programs, say over 100,000 lines,
and certainly over a million you need a language with good
support for that kind of work. ADA, Eiffel, COBOL,
(and just maybe C++)  etc

The main reason COBOL has remained the most commonly
used language for large projects is its superlative support for
that kind of environment. Small COBOL programs are a pain
because you have to do so much to set it up, but on big projects
those very same constraints become a godsend. It's interesting
to note that most of the very big projects that fail have tried to use
other languages than COBOL and run into problems. COBOL isn't
necessary but it has a huge culture behind it for these kinds of
jobs - we have learned how to do it in COBOL, we are still
learing in Java, C++ etc.

Alan G. 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Two Newbile Questions: porting drawmap.c, & Python as a lifetime language

2006-07-04 Thread Carlos Daniel Ruvalcaba Valenzuela
Really depends on what you do, if you program for a living most
probably you'll use whatever your employer tells you to use, if you
work by yourself you can choose, personally i like python because of
the enormous amount of modules available to do all sort of stuff, from
GUI programing, to unittest, database, compression, graphics (OpenGL),
etc.

I like it because is crossplatform, it may not be fast but most
modules are written in C already and are fast.

I like the ability to use py2exe and generate a windows executable in
a folder with ALL that i need to deploy on windows, i just copy the
folder and i'm done.

The Python comunity is very nice too, this is a big plus if you are
learning a new languaje, the tutor list is always very helpful and
active.

You can always make use of your C skills even on Python, by writting
modules to extend python functionability or to speed it up.

Good Luck!

Regards
Carlos Daniel Ruvalcaba Valenzuela

On 7/4/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > 2. Seeing Python hailed as a good language for learning programming,
> > how do you
> > rate it as a lifetime language? (I can imagine that many people have
> > settled into one language for doing the remainder of their life's work. 
> > If
> > I am pressed, I will choose Perl at this point.)
> Python is great as a general-purpose programming language and it is my
> language of choice today. But I'll be pretty surprised if it keeps the
> spot on the top of the heap for the rest of my working life...
>
> Kent
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Two Newbile Questions: porting drawmap.c, & Python as a lifetime language

2006-07-04 Thread Kent Johnson
[EMAIL PROTECTED] wrote:
> 2. Seeing Python hailed as a good language for learning programming,  
> how do you
> rate it as a lifetime language? (I can imagine that many people have
> settled into one language for doing the remainder of their life's work. If
> I am pressed, I will choose Perl at this point.)
Python is great as a general-purpose programming language and it is my 
language of choice today. But I'll be pretty surprised if it keeps the 
spot on the top of the heap for the rest of my working life...

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Two Newbile Questions: porting drawmap.c, & Python as a lifetime language

2006-07-04 Thread Dustin J. Mitchell
[EMAIL PROTECTED] wrote:
> 1. What's involved in a port of a C program into Python?  (drawmap is  
> offered in a number of linux distributions btw.)

It really (really) depends on the C program -- C's so flexible that you
can write in a "Pythonish" style (specifically, avoiding pointer tricks,
keeping OS-specific stuff to a minimum, and using good functional / data
abstractions) or in a style that's so obfuscated as to make any sort of
translation impossible.  The flip side of that is that Python is
flexible enough to accommodate many programming styles.  It sounds like
this program basically parses an input file and produces an output file,
 so I would bet that you can find some existing code that will read the
input file, and some other existing code that will write the output
file.  Then you just have to write the middle part.

> 2. Seeing Python hailed as a good language for learning programming,  
> how do you
> rate it as a lifetime language? (I can imagine that many people have
> settled into one language for doing the remainder of their life's work. If
> I am pressed, I will choose Perl at this point.)

Eep, Perl!  Once a polyglot, always a polyglot.  My choice of language
depends on the context.  For quick web stuff, PHP (O! How I hate thee!).
 For quick manipulation of files and/or using lots of external programs,
shell.  For just about everything else, Python.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Two Newbile Questions: porting drawmap.c, & Python as a lifetime language

2006-07-04 Thread dnelson
Relying heavily on the "newbies treated well" advertisment... :^)

I'm an old C programmer, which is to say (a) I am old, and (b) even  
when young, I somehow managed to program in "old C".

I have been working--for years--on creating a personal variant of  
drawmap.c, Fred M. Erickson's wonderful  
USGS-maps-to-shaded-relief-or-contour-map-renderer, and I have finally  
hit the wall. I have managed to make things sooo complex that the  
effort to learn a new language no longer seems unaffordable.

I am seeking opinions from seasoned veterans on the following two questions:

1. What's involved in a port of a C program into Python?  (drawmap is  
offered in
a number of linux distributions btw.)

2. Seeing Python hailed as a good language for learning programming,  
how do you
rate it as a lifetime language? (I can imagine that many people have
settled into one language for doing the remainder of their life's work. If
I am pressed, I will choose Perl at this point.)

Humbly,
--
David

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor