[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Programming first steps.



Gunnar Wolf wrote:
I strongly reccomend Perl. Why? Well, that's how I learnt (or more
properly, how I picked up after years of inactivity) programming (I
had only BASIC experience before that). Perl is a language meant to be
easy to write - Yes, your first code will probably not be very
maintainable until you reach enough skills, but it will let you
concentrate on how to program, how to deal with programming concepts -
Don't care about what goes on behind scenes, there will be plenty of
time in the future to learn about memory management and stuff. I think
a newbie will really appreciate Larry Wall's vision of a
pseudo-natural programming language.

All of this applies equally to Python (and most other scripting languages out there, to be honest) and I'd send a newbie to Python long before inflicting Perl upon them. Don't get me wrong I started in Turbo Pascal and really didn't get my grounding in programming until Perl but I sure wish Python were around in the day.

Perl's TIMTOWTDI is a nightmare for beginners. Sure it's nice to know you can do something different ways until you start reading examples which actually start doing things multiple ways. A lot of programming isn't they syntax it is the concepts the syntax is supposed to convey. Thinking in the concepts is the hard part. Finding how to express those concepts is just looking things up in a book. But in the beginning the two are the same. One is learning both the concept and the syntax. Throwing a language at them with multiple syntax for the same context is cruel and unusual punishment.

Python's diametrically opposed philosophy is much better. There should ideally be only one obvious way to do something. With that in mind the language itself is much smaller. Concepts are tied to one, maybe two syntax. So in learning both at once, especially by reading examples, it is much easier.

Finally there is the simple fact that Python is interactive. There have been many cases where I have a window on the left with my code and a window on the right sitting in Python where I hash out my ideas because I'm not quite sure how things are going to flow yet or exactly how the syntax works. I can play with the syntax, keep my data fairly static, work out each step in detail and as I do put that in the script on the left. IE, nothing quite compares to learning how slices work across all kinds of sequences other thank just playing with them like this:

{grey@teleute:~} python
Python 2.3+ (#2, Aug 10 2003, 11:33:47)
[GCC 3.3.1 (Debian)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> foo = '12345'
>>> bar = '1 2 3 4 5'.split()
>>> foo
'12345'
>>> bar
['1', '2', '3', '4', '5']
>>> foo[2:3]
'3'
>>> bar[2:3]
['3']
>>> foo[1:3]
'23'
>>> bar[1:3]
['2', '3']
>>> baz = tuple(bar)
>>> bar
['1', '2', '3', '4', '5']
>>> baz
('1', '2', '3', '4', '5')
>>> baz[1:3]
('2', '3')



--
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
       PGP Key: 8B6E99C5       | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------

Attachment: pgpm4MXboZyhy.pgp
Description: PGP signature


Reply to: