psss...I want to move from Perl to Python

James Harris james.harris.1 at gmail.com
Fri Jan 29 06:03:44 EST 2016


On 29/01/2016 09:12, Ulli Horlacher wrote:
> Steven D'Aprano <steve at pearwood.info> wrote:
>
>> Every time I make a half-hearted attempt to learn enough Perl syntax to get
>> started, I keep running into the differences between $foo, %foo and @foo
>> and dire warnings about what happens if you use the wrong sigil
>
> I have started learning Python several times and surrendered because my
> brain was too Perl hardcoded after 30 years, but NOW I was successful :-)

I nearly gave up with Python at the very beginning before I realised not 
to mix tabs and spaces.

> (I still find Perl syntax better...)

Perl may be easier to 'think in' for those who are familiar with it. 
Perl syntax is shorter. And expressions have fewer elements as some 
operands are implied.

Python's constructions are more explicit, making the effect more 
apparent in the source.

> About the variables in short:
>
> $foo is a scalar (number, string, reference, file handle)
> @foo is an array
> %foo is a hash (dictionary in Python slang)
>
> and yes, you can use them all together in same code, they are different.

IIRC it's not quite that simple in that the type depends on the context 
that Perl thinks is current. I won't go into detail as this is not a 
Perl group but I found Perl horrible to work with. It is slick but also 
cryptic.

James




More information about the Python-list mailing list