Camels & snakes

Giorgos Keramidas keramida at ceid.upatras.gr
Fri Sep 20 23:37:01 EEST 2002


On 2002-09-20 20:06, Panayotis Prokopiou <pprok at softlab.ece.ntua.gr> wrote:
> Dimitris wrote:
> 
> >Πού να δώσω τον πολύτιμο χρόνο μου, σε Perl ή σε python? ***
> 
> idou h aporia!
> to idio dilima exo kai ego.
> Afto pou me fofizei sthn perl einai oti apo osa akouo o kodikas ths 
> einai polu disanagnostos, kai an deis kai to scriptaki tou keramida tha 
> katalabeis ti ennoo (o, nai! uparxei poly kodikas se afth th morfh, exo 
> dei kai xeiroterh).

To script to egrapsa se ligotero apo 5 lepta, akribos gia na
uposthrikso argotera to palio mou asteio pou paei kapos etsi:

    Ypopsiazomai oti an kapoios prospathisei na grapsei Perl kwdika
    pou na moiazei polu me PPP noise, einai toulaxiston mh-mhdenikh h
    pithanothta na to kataferei.

Sinithos otan grafo Perl moiazei kapos etsi, bebaia:

    while (defined($line = <STDIN>)) {
	chomp $line;
	# do stuff
    }

Pou 8umizei para polu C.  H entuposi pou mou edose kapote h Perl, otan
protoasxolithika, htan "mia intepreted C me uposthriksh gia regular
expressions".  Meta apo 5 peripou xronia, sunexizo na pisteuo oti h
Perl einai mia uperoxh glossa gia na kanei kapoios programmata pou
exoun san basiko skopo to parsing.

> Apo thn allh h python exei mia idieterothta. ksexorizei ta blocks
> apo to intendation (tabs). To thetiko edo einai oti den grafei
> kaneis opos thelei, alla oloi grafoun to idio. To arnhtiko einai oti
> einai kapos parakseno...

Sto tutorial ths Python pou exei sto www.python.org leei ena polu kalo
sxolio sxetika me auto to thema.  Oloi oi programmatistes pou exoun
grapsei kodika se kapoia glossa me blocks kai nesting, otan katalaboun
pos h Python dinei megalh shmasia sto nesting me ta spaces, skeftontai
amesos "Oh shit!" kai kanoun ena nohtiko bhma piso, akribos san na
pathsan se mia lakouba me skata apo elefantes :-P

> Stis nees ekdoseis kai ton 2 glosson apo oso ksero tha uparksei kapoia 
> antalagh "texnognosia", px perl regular expressions.
> Tellos, h python einai h monh glossa h opoia kanei afto
> a, b = b, a
> !!! nai, afth einai h swap.

Kala, min pairneis ki orko:

    keramida at hades[21:00]/home/keramida$ perl
    ($a, $b) = (1, 2);
    ($a, $b) = ($b, $a);
    print "a=$a, b=$b\n";
    ^D
    a=2, b=1

H dikh mou gnomh einai, mathe kai tis duo an mporeis.  Kapoioi tha
poun "ma den exo xrono na matho dekaefta glosses scripting, kai eikosi
pente compiled glosses .. gia na min anaferoume tis functional pou
einai kamia dekaria parapano".

Fusika, kaneis den exei xrono na tis mathei oles.  Alla mporei opoios
exei orejh na mathei toulaxiston mia-duo apo kathe eidos.  Den einai
anagkh mesa se ena mhna na ginei olos o kosmos expert se trianta
glosses programmatismou.  Ektos ki an se kinigaei kapoios gia douleia,
opote mporeis kallista na tou zhthseis kai ta analoga uperogka posa
gia na matheis oses glosses thelei kai se oso xrono thelei :)

-- 
FreeBSD: The Power to Serve <> http://www.FreeBSD.org
FreeBSD 4.6-RELEASE #0: Wed Sep 18 23:08:01 EEST 2002



More information about the Linux-greek-users mailing list