Raspberry Pi 2 Model B

On 02/24/15, Gordon Levi pondered and said... GL> Do not learn C++ at all unless someone pays you large sums of money to GL> do so! If you want to learn a low level, object oriented language Java GL> is the popular choice and it is not cluttered with forty years of GL> backward compatibility.

Hmm OK.

GL> Python is the obvious choice for programming on the Pi. It is a GL> straightforward language and there is a large body of code already GL> written for the Pi that you can use as a starting point for your GL> programs. Guido van Rossum should be lynched for introducing a new GL> incompatible version of the language and I suggest you stick with the GL> Version 2.7.

Python seems the obvious choice given it ships with the Pi, that said it seems the main website extolls the virtues of Python 3 and views ver 2 as only needed for backwards compatibility.

--
    Agency BBS, New Zealand | bbs.geek.nz | telnet: agency.bbs.geek.nz:23
Reply to
Paul Hayton
Loading thread data ...

Yes. I tried to upgrade myself to Python 3 a year or so back, and discovered that there were enough dysfunctions in the wider environment (IDEs and framework libraries) that it was more trouble than it was worth. There aren't that many differences in Python 3, so I'll wait a couple of years yet. So a vote from me for Python 2 too.

Also I've been meaning to try PyPy (the just-in-time compiler version of Python) on the Pi. The PyPy people have just issued PyPy 2.5.0, and there's a binary for the Pi, so it'll be interesting to see how fast that runs. On the PC, I find that loops with a lot of simple maths are sped up enormously. PyPy is a bit more complex to set up than the usual CPython interpreter at the moment because in order to install libraries you have to set up a virtual environment and install libraries from the PIP (Python Package Index) with the 'pip' tool. And only some of the libraries work correctly because they were tested against CPython. Anyway, the PyPy developers have also expressed annoyance at the Python 3 thing, because they have to ask people that have just had to rewrite their libraries for Python 3 that they might also need to do a bit of work to make them compatible with PyPy.

Reply to
Dave Farrance

Or you could just use Perl, which also ships with the Pi but doesn't have the same promotional effort behind it, and is all about getting stuff done. OO? No problem. Functional? We can do that too.

Reply to
Roger Bell_West

Indeed, as a very late starter and dabbler with Perl, there is always another bit you haven't come across before - and another book to buy!

I remember coming across it years ago and at that time it looked almost unintelligible, funny how things change.

fruit

Reply to
fruit

For a fresh start, non production, Python 3 seems like the dead obvious choice. Even Pygame is now Python 3 compatible (version 1.9.2 is in the repositories).

Reply to
A. Dumas

But can you read & understand the code after it is written? after 6 days? after 6 weeks? after 6 months?

Perl has a reputation for being a write only language where as the Zen of Python states "Readability Counts"

the differences between python2.7 & python 3 are not as great as people make out. if you use the correct from __future__ imports writing code that will run in both is almost seamless

admittedly there are some modules that do not support V3 but switching between the 2 is no harder that switching between English & American.

Us Brits do that on a daily basis when we watch US TV programs.

--
"Trust me": 
	Translation of the Latin "caveat emptor."
Reply to
alister

This could be descending into a religious war, but IMO, Perl is the most annoying, obfuscated, non-intuitive, convoluted, write-only language ever dreamt up. Larry wall is a linguist, not a computer scientist, and it shows.

Of all the interpreted languages, give me Python any day.

Reply to
Tony van der Hoff

My experience of Perl is that, while it works OK, it's very good at producing unintelligible code.

Code that I've written in Python I can return to in five years time and understand. Code that I've written in Perl isn't nearly so easy to come back to.

Python has a number of things that tend to (no language can force good habits) make one do things such that they're explicit and easy to follow. It doesn't have any implicit variable usage (which is one of the most opaque things about Perl), it forces fairly sensible indenting and it's pretty regular and orthogonal.

OK, language choice is always going to be personal, but I have been at it (programming) since the early 1970s so I do have a bit of experience.

--
Chris Green
Reply to
cl

Yes. Even that famous Perl-hater Eric Raymond has praised the readability of my Perl code.

You can write badly in any language. You can write well in any language (even PHP).

When learning a language, especially when learning a first language, I've found that it's important to get stuff _done_: not just toy programs, things that actually achieve something useful. That way there's a palpable sense of progress, more than just "getting through the course". IME Perl is particularly good for getting stuff done.

Reply to
Roger Bell_West

Of course that depends how you write it[1] - if you write it with legibility/maintainability in mind rather than hacking together something that uses all the neato perl tricks (that provide umpteen different ways to do the same thing, each smaller and more obscure than the last) then you'll have a bit of structured and commented code that anyone can read. That doesn't mean you mustn't use the tricky stuff - it's fine in your personal-use tools, and the annual obfuscated code competition.

[1] Just like C++ - you can write good OO code, but it doesn't force you to. You can hack together an incomprehensible jumble of C pointer arithmetic and self-modifying code if you really don't like your boss.
Reply to
Rob Morley

True, & it is possible to write confusing/unreadable code in Python the main difference is Python make writing such code difficult so by the time you have learnt how to make an unreadable mess you know better :-) making indentation part of the syntax forces a good programming style. (& it matches what good programmers do with languages that use braces anyway!)

To paraphrase what someone more knowledgeable than I once said, debugging code takes more intelligence that writing it, therefore if you write code that is a "clever" as you can then you are by definition not smart enough to maintain it.

Python is not likely to be much use in the obfuscated code contest though.

Python also handles OO & procedural code without forcing either.

I have no issue with perl, many of the useful scripts i run are written in it. I have written in basic (in the 80's) and programmed assembler for a living personally I have found python to be the easiest language to pick up but previous experience may have helped.

C I have never been able to stomach as it is too low level for my liking

--
Therefore it is necessary to learn how not to be good, and to use 
this knowledge and not use it, according to the necessity of the cause. 
 Click to see the full signature
Reply to
alister

You mean "I write perl that can be unintelligible".

Perl tries to not get in your way and forbid you from shooting yourself in the foot. It is up to the coder to not shoot themselves in the foot.

--
Consulting Minister for Consultants, DNRC 
I can please only one person per day. Today is not your day. Tomorrow 
 Click to see the full signature
Reply to
I R A Darth Aggie

I agree but I don't think that a novice programmer is best served by making a "fresh start". A good way to learn and the way to get an application running quickly is to use existing code. Most of the existing code is in Python 2.

Reply to
Gordon Levi

PERL seems to attract programmers whose idea of being clever is to write code no one else can understand or maintain.

Along with REGEXPS it far outweighs the GOTO statement as somnething to be avoided by anyone whose intentions are to provide workable solutions that can be maintained by others.

--
Everything you read in newspapers is absolutely true, except for the  
rare story of which you happen to have first-hand knowledge. ? Erwin Knoll
Reply to
The Natural Philosopher

IME that's the way to teach people how to do "cut & paste" coding where they don't really know what's going on.

Reply to
Rob Morley

I don't understand why people say that. Is it just the way it handles pointers, or is there something else that makes it low-level with negative connotations?

Reply to
Rob Morley

formatting link

So, you don't approve of getting rid of 15 years or so of backward compatibility?

Reply to
Raymond Wiker

Unreadable? Yep we have that in bucket loads.

Reply to
mm0fmf

Odd. C goes from the lowest to the highest levels. That's why it is as successful as it is.

--
Everything you read in newspapers is absolutely true, except for the  
rare story of which you happen to have first-hand knowledge. ? Erwin Knoll
Reply to
The Natural Philosopher

probably because I had to worry about every last bite when writing in 8 bit assembler - 127 BYTES of ram 4k rom (2k of which was needed for various lookup tables. I really do no want to have all that overhead just to write a simple utility/app for personal use.

I am sure that is i sat down and forced myself I could but higher level scripting languages enable me to be far more productive in my own time

--
Eloquence is logic on fire.
Reply to
alister

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.