Is anybody coming from Pascal?

Radovan Garabik garabik-news at spam.melkor.dnp.fmph.uniba.sk
Sat Jul 21 17:06:24 CEST 2001


Edmund Strangely <edmund at ngetal.fsnet.co.uk> wrote:
 : Hello,

 : I've been lurking here for a while while working my way through 'Learning
 : Python'. So far only a few things have pissed me off with it. I was just
 : wondering, is anybody else coming from Pascal? Or Modula2/3? The book I am

I came from solid Turbo Pascal background on MSDOS to linux, made a few
C programs and then discovered python

 : reading kind of assumes that you are coming from C, and as I understand it
 : Python is written in C which is why it shares some of the same
 : conventions. Python is my first object orientated language. Pascal was my

me too

 : second programming language (after BASIC on a spectrum) and although I

me too

 : sort of learned C later, I still prefer Pascal. I personally like it more

me too

 : than C for a few reasons. I don't think that I should have to worry about
 : how many bytes precisely my variables are stored in. (And I like BASIC
 : even better in this respect, in that integers and fp numbers are
 : automatically converted, and strings will grow and shrink as required (as
 : in Python seemingly)). I don't like the fact that in Python if

me too

 :>>>a=5
 :>>>b=2
 :>>>#and then
 :>>>c=a/b
 :>>>#then
 :>>>c
 : 2

 : in Pascal if you *want* modulo arithmetic (which is not normally the case
 : ) then you have DIV and MOD. I like having a distinction between functions

this I feel is a big design mis-decision in python. I liked div and mod
(/ as integer division is UGLY and having % instead of mod just goes
against main python principle, readibility)

 : and procedures, for purely aesthetic reasons (I think having loads of
 : function names followed by () just looks ugly, procedures don't give

it looks ugly, but since in python everything is reference, you somehow
have to tell the interpreter where to perform a call. I got used to it
quickly.

 : return values). Python only has functions, but I can forgive it that. But
 : the one thing above all that I think Pascal has over C (and which Python
 : shares) is that you can nest your procedures/functions! Most of my Pascal
 : programs had a mere few lines in the 'main' body of the program and the
 : rest would be large functions and procedures each with their own
 : sub-procedures and sub-functions with their own sub-sub units etc.

it was nice, and (unlike python) did not impose runtime penaly.
I un-learned to use nested function in python because of this. Shame.

 : When I
 : first started on C I just couldn't *believe* that you couldn't nest
 : functions, and just had to put them one after the other! You call that
 : structured programming?

Nobody calls programming in C structured :-)

 : I conclusion, and in reviewing this post, I seem to have been rambling a
 : bit (it's a bit late/early in the day) but I'd be interested to get a
 : response from anybody else who rates Mr Wirth, and in how any such people
 : finding the transition. I'd also be curious to hear from anybody who has

What I miss from pascal are arrays and enumerated types.
Lists are not the sameas arrays, NumPy is clumsy and unreadable and not
part of language.
Enumerated types were really nice and allowed you to concentrate
on the logic behind the program, not on the program by itself (and
were compiled pretty effectively). Having to simulate them
by strings or classes in python is just not the same.

Also the nested scopes problem in python is something at which
I stared in disbelief. How can a programming language have _this_
mess about scopes and claim to be logical and readable?
Pascal was perfect in this respect.

You can chooe between call by reference or call by value in pascal.
Python has internally only the former, but for the programmer the
overall effect looks like it arbitrarily uses sometimes the former,
sometimes the latter. Yuck.

 : tried object Pascal.

I tried (at the time of TP 5.5)
First I had troubles getting the concept of OO, then I did not
see much value in it, and quickly abandoned it, until I discovered python.

Ideal language for me would be (together with above-mentioned)
pascal-like, with python syntax, typed (allows effective compilation),
with (turbo)pascal and python types combined (char, byte, unicode char,
int, longint (double the size of int), int16, int32, int64 - to
explicitly tell the size, these are needed e.g. for network
applications, real, double, rational, infinite long (python-like),
list/tuple, dictionary, string, boolean (yes!), complex), pascal-like
arrays, do..while loop, pascal-like
for a:=something to b step c loop, python-like for i in something loop,
python-like OO, and, of course, with python-like variety of
external modules :-)


--
 -----------------------------------------------------------
| Radovan Garabik  http://melkor.dnp.fmph.uniba.sk/~garabik |
| __..--^^^--..__         garabik @ fmph . uniba . sk       |
 -----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!



More information about the Python-list mailing list