News:

Let's find out together what makes a PIC Tick!

Main Menu

Thank god for Les

Started by RGV250, Feb 11, 2021, 10:33 PM

Previous topic - Next topic

RGV250

Hi,
It is not until you have to use other crap that you realise how easy we have it.
I think I have the need to use a Raspberry Pi, I have spent the last 4 or 5 hours tearing my hair out trying to do simple things that PDS could do without thinking about.
Python has to be the biggest pile of garbage I have ever had to use, no wonder software these days is crap if that is what the kids are being taught.
I could not believe it when it complained I had an indent in the wrong place.

I have 3 (possibly 4) serial USB devices and would like to show the data in a graph on a web browser, the Raspberry Pi seemed like an ideal solution but if Python is the best it has to offer I am going to give up, it is utter garbage.

At least it gave me an excuse to have $A beer.

Bob

Yakovlev

For the project you outlined, on a Raspberry Pi, you might want to try out Node Red for its baked in web graphing UI nodes, plus scope to RYO.
Rob R

keytapper

#2
Quote from: RGV250 on Feb 11, 2021, 10:33 PMI could not believe it when it complained I had an indent in the wrong place.
That is the strictest rule for Python to determine which block of code is concerned. Getting used of it will give a better understanding why it's used. Mixed tabs and space for indentation, are also making some annoyance.
Same rule permits to continue a long line, like C for an instance, one block between parenthesis is allowed to continue on the next line. So that is another rule to keep the page with within 80 columns.

Some time also the proton basic may complain for incorrect closing block, then it's useful to have a good text editor that can process the code folding correctly, which will guide us to find a missing closed block.

In fact some time the indentation will show where one block of code starts and where it stops, just by moving the cursor up or down on the same column. For a simple text editor.
At the same style we may consider the use of indentation also for the basic. When the compiler will tell a missing closed block just use the technique to move the cursor on the same column. One more care is to note the longest block with a particular remark.
Ignorance comes with a cost

tumbleweed

QuoteGetting used of it will give a better understanding why it's used
Python is the ONLY language I've used where whitespace and indentation matters. With every other language its use is optional, and doesn't change the program struture.

Whoever came up with that arrangement should have been shot.

RGV250

Hi Tumbleweed,
My sentiments entirely, it was not just Python but the whole Raspberry Pi experience. I had a second hand one where I had to reinstall the OS so Python did not sulk about the serial commands. It also seems to be case sensitive which is a pain if you don't know what is and isn't required. The keyboard does not work properly with special symbols all over the place. Most of the examples did not work including the ones in the manual and googling it loads of others had problems just getting data from a serial port.
Now I have the data I cannot do anything with it as it has a carriage return which I cannot find out how to get rid of.
It seems very much like Arduino, if it works then great but if you want to do something different then you are in a world of pain.
All in all the only good part of the experience was the amount of beer it made me drink.

Thanks Yakovlev, I will have a look at Node Red as the documentation looks well laid out.

Bob

keytapper

I confess I use python, since version 2.2 and I wrote some simple code.
Every language has its own rules. Approaching with a different perspective may cause some frustration.

There was a freedom to mix tabs and spaces, but this was only a difficult to catch where one indentation block could finish.
I was happy to install micropython (MP) for an ESP8285. That gives a solid base to run programs, rather than load compiled one. The advantage is when a program fails, the MP will recover the control and let us see where the error got started.
Ignorance comes with a cost

tumbleweed

QuoteThere was a freedom to mix tabs and spaces
If you've ever made the mistake of loading a python program into an editor that was setup differently from the one originally used, god help you.
There's no way to recover... your program is lost forever.

That to me isn't an acceptable "language rule" or matter of style, it's a major flaw.

For those of you not familiar with python, instead of having blocks defined by statements like "begin-end", "while-wend", or even like C's "{ }", it defines its blocks purely by the indentation. Delete a space char on a line? Mix tabs and spaces? Oops, shouldn't have done that!

Other than that it's great.

RGV250

In Python I tried to comment some code out but it did not like the remaining code as the indentations were then in the wrong place.

I have tried Yakovlevs suggestion of Node Red and have pretty much made a framework for what I wanted to do. I had to do a did of searching but it is very straight forward and it works.

Bob

keytapper

@RGV250
You may use the pychecker, which will help to reformat the source correctly (almost  :D )
The case is how you expect to have results with python. If this will be the only case that you need to complete, then you done it. But if you have future development, you may face that python is one of the most languages used in linux environment.
Ignorance comes with a cost

top204

#9
Python always puts me back to the 1980s, where interpreted languages dominated, until there was something complicated needed doing, and they "could" do it, but too slowly.

This was overcome by the advance in computers back then, that got faster and faster, but even then, the  interpreted languages simply could not keep up with the quality required back in the 1980s and 1990s. However, we now live in a culture where "quality" doesn't matter and what people want is free! and lots of it! regardless if it is not very good. LOL

Just look at some of the microcontroller dev units, and Java and C#.... Dreadfully slow, bloated, languages compared to "good" compiled languages, but still used too much, and the programs that are written with them are slow, sluggish, and very, very bloated.

HAL

I completely agree.  Downloaded python and read a few tutorials.  I believe we all use indentation in code, but the difference for me is the indentation is where and when I want it.

While searching for tutorials, one good thing came as a result, I somehow found Proton Basic Compilers.  The Raspberry Pi is somewhere in a box.  Haven't seen it two years.  Don't plan to look for it anytime soon!

Best regards
HAL

keytapper

Many of us, with more than half century on the shoulder, approached the programming with an interpreted language, BASIC, ZX, QL, C=, Amiga, Atari, Amstrad. Then that is what is leading many of us to use a BASIC. Other languages, like python are a blend of the interpreted languages.

The fact that they are entirely interpreted is a lie, indeed there's a intermediate operation to tokenize the instructions. But to say that a RPi needs only python for certain operation is incorrect. There might be several languages that can be implemented on a SoC, not excluding a BASIC, like Gambas or FreeBasic.

G. Van Rossum (the Python author) decided that clearness on the code is a must, so he assumed the indentation as a statement to write the code. Also he's the BDFL.
Ignorance comes with a cost

HAL

Hi keytapper
Your post gives me an idea.  We have many acronyms around as BDFL as you mentioned.  Also TGIF for Friday.  How about a new acronym for the forum?  How about TGFL as this thread is named Thank God for Les!  I know I've said it more than once.  Not to diminish any of the great, knowledgeable, friendly, and helpful people on this forum.  But for fun.
Best regards & TGFL
HAL

John Drew

#13
I see that DuckDuckGo has found ProtonCompilers as has Bing, but Google hasn't yet - at least based on my efforts.
One small step!
John

HAL

HI JOHN

I USE THE DUCK.  WORKS WELL.

REGARDS
HAL

keytapper

I used https://www.startpage.com/, my favorite search engine.
Than later, our member Amod, notified me about the new site.
Ignorance comes with a cost

top204

#16
Over the years, I have found the G##gle search engine to be very poor, and getting worse.

All it does is place adverts at the top of the list and give results that are not actually relevant to the search if it can't quite find a result. All it seems to want to do is fill the page with "stuff", and adverts dotted all over them with the texts given in the search bar. So I gave up on it. Unfortunately, that is now the society we live in.... Lots of something, but quality doesn't matter.

I have tried Duck and found it OK, but I'll try that link you have given Keytapper. Thanks for that.

Stephen Moss

Quote from: John Drew on Feb 15, 2021, 05:30 AMI see that DuckDuckGo has found ProtonCompilers as has Bing, but Google hasn't yet - at least based on my efforts.
One small step!
John
I tried a Google search for "proton compiler forum" the day I found the forum (via link in Proton Studio) and just tried it again today and both times it appears on the third page of results, so Google does know it exists.
If it is not listed for you then perhaps being a new site it not fully trusted/tested and found to be safe and so its listing in your search results is being blocked by your Google or antivirus settings.

See_Mos

I was reading about duckduckgo at the weekend, apparently there is a way to turn off advertisements and some quick short cuts for the likes of Amazon !a or !e for Ebay and many more.

Advertisements on Bing and Google are becoming extremely annoying

John Drew

@Stephen, I must admit I only checked the first two pages on Google as it seemed to be providing irrelevant searches.
Me being impatient :)
Duck had it on the first page and just part way down. Pretty good.
Bing, like Google has far too much rubbish. The paid for priority sites take over the best spots.

I see on tonight's news that Google has agreed to pay at least one news network for using their news - as they should.

Their threat to shut our country out was a hollow one. That company is getting too powerful. Part of the reason I've revisited Duck.
John