Musketeer
Posts: 152
Joined: Fri Feb 12, 2016 1:23 pm
Location: CZ

I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Wed Jul 10, 2019 7:31 pm

Its 20-100x times faster and uses 20-100x less RAM?
Linux is like woman - both wants 180 % of your time...
You want speed Java 9.8x? Throw it out of some Window(s)!
My girlfriend is terribly unmature - she always sinks my boats in bathtub!

User avatar
Imperf3kt
Posts: 2862
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Wed Jul 10, 2019 7:41 pm

Probably because compared to Python it's 20-100x harder to learn
55:55:44:44:4C
52:4C:52:42:41

Musketeer
Posts: 152
Joined: Fri Feb 12, 2016 1:23 pm
Location: CZ

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Wed Jul 10, 2019 8:29 pm

I don't know... Basic cycles and other logic is almost same everywhere + not THAT hard...

You can do for example Fibonacci numbers in anything.

If someone want good readability I would expect they use Object Pascal with all its

type x := int
Begin
ReadLn(x);
WriteLn(x);
End
Linux is like woman - both wants 180 % of your time...
You want speed Java 9.8x? Throw it out of some Window(s)!
My girlfriend is terribly unmature - she always sinks my boats in bathtub!

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12324
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Wed Jul 10, 2019 8:59 pm

don't get me started on the uses of semicolons in Pascal.

An interpreted language will always be slower than a compiled language, but for learning (and much else) that doesn't matter.

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 3:58 am

Musketeer wrote: Its 20-100x times faster and uses 20-100x less RAM?
I am with you 100% on that one. Especially when it comes to CS schools that should be teaching the fastest most effecient way to do things, and how to figure out how to do it even better.
Imperf3kt wrote: Probably because compared to Python it's 20-100x harder to learn
Have you ever looked at Perl and Python? They are way harder than C, I have yet to figure out how to do indirection (eg poitners) in Python, and indirection simplifies a lot of algorithms.
mahjongg wrote: An interpreted language will always be slower than a compiled language, but for learning (and much else) that doesn't matter.
At university level?

Not to mention that using an interpreted language that is harder to learn than the compiled alternative??
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
Imperf3kt
Posts: 2862
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 5:11 am

DavidS wrote:
Thu Jul 11, 2019 3:58 am
Imperf3kt wrote: Probably because compared to Python it's 20-100x harder to learn
Have you ever looked at Perl and Python?
I will admit, personal opinion heavily swayed my response, but yes, I have looked at all the languages mentioned here.
Python is my personal language of choice as it is easiest to me.

I frequently use Python, almost daily I am writing something with Python, even written games using a Python based engine (though I will admit, that is written in C and Cython as well)
55:55:44:44:4C
52:4C:52:42:41

Heater
Posts: 13596
Joined: Tue Jul 17, 2012 3:02 pm

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 5:11 am

Musketeer,
Its 20-100x times faster and uses 20-100x less RAM?
I refute your premise there.

When you are teaching a beginner about programming you want to start with simple things 'print ("Hello world")', then move step by step to more complex concepts, numbers, variables, assignment, statements, conditionals, loops, functions, etc. After all, all of programming is nothing more than: sequence, selection, iteration.

Starting from those simple beginnings, getting kids to write a main() function, and use the required includes, and have to worry about semi-colons, and explain the not obvious commands to compile and run the program, etc in C will be a lot slower and more confusing for them than just typing into a Python or other REPL.

Besides, that requires a C compiler and and a compilation step. At which point you have used far more RAM and run time than typing into a REPL and instantly getting a result.

It's the same reason BASIC was invented back in the day, and used successfully to introduce a generation or two of kids to programming.

Of course, I agree, soon after that initial experience they should move on to more efficient things. After all, Python causes global warming and climate change when used on a large scale.
Memory in C++ is a leaky abstraction .

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 5:28 am

@Heater:
The OP indicated they were talking about at university level, far from beginning programmers. The University level indication is in the title of the thread itself.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

plugwash
Forum Moderator
Forum Moderator
Posts: 3462
Joined: Wed Dec 28, 2011 11:45 pm

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 5:41 am

Languages like python just lets you get stuff done far more easily than C (or even C++). You can run the code immediately rather than having a compile step. You can even experiment with calling functions interactively and inspecting the results. You can just write the code to do what you want to do rather than spend ages messing around with data structure design and memory management. When you make a mistake or misunderstand the interface to a library things are far more likely to fail cleanly rather than flying off into memory corruption hell.

Now the price you pay for that is lower execution speed. There are certainly cases where the effort to take a bunch of python code and rewrite it in C are worthwhile, but equally there are many cases where it is not. An awful lot of coding is just tying together libraries that do the heavy lifting and there are python wrappers for a lot of libraries.

jahboater
Posts: 4761
Joined: Wed Feb 04, 2015 6:38 pm

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 8:01 am

Every time I look at these interpreted languages I keep yearning for the simplicity and precision of C.

There have been vast numbers of posts about xxxxBasic on this forum, but despite there being a fairly recent ISO standard (2008), none of the BASIC developers seem to abide by it (most I suspect are not even aware of it). So we have discussions about how a for loop should behave. Randomly chosen syntax at the whim of the developers. Weird syntax for doing things that are trivial and clean in C.

Then we have the Python 2/3 nonsense. That would not be acceptable in for C with its vast amount of existing code. The C standards progress slowly and carefully over decades. You may for example still use the old K&R style function definitions from 40+ years ago in modern C code (not that you would want to).

Then I see Javascript (and others) where I cannot look at the code and understand how basic arithmetic is being done. In C with its static typing, standardized type promotions etc, it is exact and well understood.

I see these languages being heavily reliant on anther language to get difficult stuff done (usually C).
Which adds the complication of mixing two languages and doesn't lead to confidence in the main language.
Even Fortran had a separate ISO standard just covering interoperability with C.

If I want to know precisely how something works in C, I can look at the ISO standard document. It is definitive and complete and the compilers follow it to the letter. They have to or they are defective.

Musketeer
Posts: 152
Joined: Fri Feb 12, 2016 1:23 pm
Location: CZ

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 8:14 am

Other fun part - lots of Javists tell you "C is hard to learn!" yet their API is like 99.99 % bigger! :P

C is pure = it is simple! :twisted:

C has "just enough" language + tools to do anything.
Linux is like woman - both wants 180 % of your time...
You want speed Java 9.8x? Throw it out of some Window(s)!
My girlfriend is terribly unmature - she always sinks my boats in bathtub!

User avatar
Burngate
Posts: 6046
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 10:41 am

Musketeer wrote:
Thu Jul 11, 2019 8:14 am
C is pure = it is simple! :twisted:
Is it?

Wouldn't it be better to go for assembler, rather than obfuscating everything with a high-level language?
That way, the student will learn what's actually happening.

jahboater
Posts: 4761
Joined: Wed Feb 04, 2015 6:38 pm

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 10:48 am

Burngate wrote:
Thu Jul 11, 2019 10:41 am
Musketeer wrote:
Thu Jul 11, 2019 8:14 am
C is pure = it is simple! :twisted:
Is it?

Wouldn't it be better to go for assembler, rather than obfuscating everything with a high-level language?
That way, the student will learn what's actually happening.
Every CS student should write just a few lines of assembler so they quickly understand whats really going on under the cover. Maybe a hundred lines or so would be enough.
Then concentrate on popular HLL's.

Musketeer
Posts: 152
Joined: Fri Feb 12, 2016 1:23 pm
Location: CZ

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 12:14 pm

They could write something simple in various languages and see the speed.
Linux is like woman - both wants 180 % of your time...
You want speed Java 9.8x? Throw it out of some Window(s)!
My girlfriend is terribly unmature - she always sinks my boats in bathtub!

Heater
Posts: 13596
Joined: Tue Jul 17, 2012 3:02 pm

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 12:15 pm

DavidS,
The OP indicated they were talking about at university level, far from beginning programmers. The University level indication is in the title of the thread itself.
No they did not. The only mention of "university" here is by you.

Besides, as noted by Eben Upton when he tells the story of why he conceived the Pi, and as noted by myself when watching the online videos of undergraduate CS courses at Berkeley and MIT, those kids coming to university to study CS have no idea about programming. They get remedial programming education from the ground up in Python, and a version of Scratch last I saw. Ten years ago it was Scheme.

That is the CS guys, for those studying other sciences it is even less likely they know anything about programming when the hit "science school"

I think my technical school had it right back in 1974. Us teenagers were introduced to programming with BASIC. After a few weeks of that we were taught assembler. We had to do projects in both and at the end of the year we were examined in both.

Following that was university, guess what, the under grads were being taught BASIC. I had to go my own way to pursue ALGOL.
Memory in C++ is a leaky abstraction .

Musketeer
Posts: 152
Joined: Fri Feb 12, 2016 1:23 pm
Location: CZ

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 1:17 pm

Heater wrote:
Thu Jul 11, 2019 12:15 pm
DavidS,
The OP indicated they were talking about at university level, far from beginning programmers. The University level indication is in the title of the thread itself.
No they did not. The only mention of "university" here is by you.

Besides, as noted by Eben Upton when he tells the story of why he conceived the Pi, and as noted by myself when watching the online videos of undergraduate CS courses at Berkeley and MIT, those kids coming to university to study CS have no idea about programming. They get remedial programming education from the ground up in Python, and a version of Scratch last I saw. Ten years ago it was Scheme.

That is the CS guys, for those studying other sciences it is even less likely they know anything about programming when the hit "science school"

I think my technical school had it right back in 1974. Us teenagers were introduced to programming with BASIC. After a few weeks of that we were taught assembler. We had to do projects in both and at the end of the year we were examined in both.

Following that was university, guess what, the under grads were being taught BASIC. I had to go my own way to pursue ALGOL.

I used this as kiddo: https://en.wikipedia.org/wiki/Karel_(pr ... _language)
Linux is like woman - both wants 180 % of your time...
You want speed Java 9.8x? Throw it out of some Window(s)!
My girlfriend is terribly unmature - she always sinks my boats in bathtub!

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 1:20 pm

jahboater wrote:
Thu Jul 11, 2019 8:01 am
Every time I look at these interpreted languages I keep yearning for the simplicity and precision of C.

There have been vast numbers of posts about xxxxBasic on this forum, but despite there being a fairly recent ISO standard (2008), none of the BASIC developers seem to abide by it (most I suspect are not even aware of it). So we have discussions about how a for loop should behave. Randomly chosen syntax at the whim of the developers. Weird syntax for doing things that are trivial and clean in C.
That I did not know, could you provide a link to the ISO standard for BASIC? Also how does it compare to the ANSI Standard (which was based on structured Darthmouth BASIC 5).
I see these languages being heavily reliant on anther language to get difficult stuff done (usually C).
Which adds the complication of mixing two languages and doesn't lead to confidence in the main language.
Even Fortran had a separate ISO standard just covering interoperability with C.

If I want to know precisely how something works in C, I can look at the ISO standard document. It is definitive and complete and the compilers follow it to the letter. They have to or they are defective.
Agreed.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

jahboater
Posts: 4761
Joined: Wed Feb 04, 2015 6:38 pm

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 2:14 pm

DavidS wrote:
Thu Jul 11, 2019 1:20 pm
That I did not know, could you provide a link to the ISO standard for BASIC?
https://webstore.ansi.org/standards/inc ... 91991r2005
However, that says it was revised in 2005, I am sure I read somewhere it was revised again in 2008.

I have read that ISO adopted the ANSI standard, so I am not convinced they are much different.

Here is list of standards from Wikipedia:

Code: Select all

    ANSI/ISO/IEC Standard for Minimal BASIC:
        ANSI X3.60-1978 "For minimal BASIC"
        ISO/IEC 6373:1984 "Data Processing — Programming Languages — Minimal BASIC"
    ECMA-55 Minimal BASIC (withdrawn, similar to ANSI X3.60-1978)
    ANSI/ISO/IEC Standard for Full BASIC:
        ANSI X3.113-1987 "Programming Languages Full BASIC"
        INCITS/ISO/IEC 10279-1991 (R2005) "Information Technology – Programming Languages – Full BASIC"
    ANSI/ISO/IEC Addendum Defining Modules:
        ANSI X3.113 Interpretations-1992 "BASIC Technical Information Bulletin # 1 Interpretations of ANSI 03.113-1987"
        ISO/IEC 10279:1991/ Amd 1:1994 "Modules and Single Character Input Enhancement"
    ECMA-116 BASIC (withdrawn, similar to ANSI X3.113-1987)
Last edited by jahboater on Thu Jul 11, 2019 2:33 pm, edited 2 times in total.

User avatar
scruss
Posts: 2542
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 2:20 pm

DavidS wrote:
Thu Jul 11, 2019 3:58 am
I have yet to figure out how to do indirection (eg pointers) in Python, and indirection simplifies a lot of algorithms.
You don't really need pointers in scripting languages. You've got arrays (lists) and hashes (dictionaries). Both can be dynamic and you don't have to worry about allocation and cleaning up. Scripting languages also bring huge libraries of tested code that you don't have to spend years developing, so in their own way, you can get results much more quickly than in C.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Heater
Posts: 13596
Joined: Tue Jul 17, 2012 3:02 pm

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 2:56 pm

If you think you need pointers to program in Python you have totally missed the point (get it :))

I would wager that pointers make thinking about code harder and that historically errors using pointers is high up on the list causes of bugs, even among skilled, experienced programmers. Pointers certainly make any formal reasoning about the correctness of a program very hard if not impossible. Use of pointers in C and C++ can make it impossible for the compiler to perform many optimizations.

Apart from all that I like a good pointer as much as the next nerd.
Memory in C++ is a leaky abstraction .

jahboater
Posts: 4761
Joined: Wed Feb 04, 2015 6:38 pm

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 3:05 pm

Heater wrote:
Thu Jul 11, 2019 2:56 pm
I would wager that pointers make thinking about code harder and that historically errors using pointers is high up on the list causes of bugs, even among skilled, experienced programmers. Pointers certainly make any formal reasoning about the correctness of a program very hard if not impossible.
I think you are saying that pointers are to data what goto's are to program control flow.

But yes, its hard to imagine working without them.

Musketeer
Posts: 152
Joined: Fri Feb 12, 2016 1:23 pm
Location: CZ

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 3:10 pm

How would you describe Javist how much improvement of speed can be gained in program by using pointers in C?
Linux is like woman - both wants 180 % of your time...
You want speed Java 9.8x? Throw it out of some Window(s)!
My girlfriend is terribly unmature - she always sinks my boats in bathtub!

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23869
Joined: Sat Jul 30, 2011 7:41 pm

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 3:21 pm

Musketeer wrote:
Thu Jul 11, 2019 3:10 pm
How would you describe Javist how much improvement of speed can be gained in program by using pointers in C?
Instead of what? Using Java?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

Musketeer
Posts: 152
Joined: Fri Feb 12, 2016 1:23 pm
Location: CZ

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 3:22 pm

Precisely, boss!
Linux is like woman - both wants 180 % of your time...
You want speed Java 9.8x? Throw it out of some Window(s)!
My girlfriend is terribly unmature - she always sinks my boats in bathtub!

jahboater
Posts: 4761
Joined: Wed Feb 04, 2015 6:38 pm

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Thu Jul 11, 2019 3:43 pm

You could take a close look at the assembler code emitted by the compiler.

You can see that quite a lot of the time, the main registers will contain pointers (addresses) instead of other data values.

That's not saying you have to use pointers all time, its just interesting that the hardware totally relies on them.

BTW, In C, array[index] is the same as *(array + index), but the former is more readable. Interpreted languages don't have that sort of direct relationship with the hardware, so pointers are unusual, unless you count things like peek() and poke() in BASIC.

Return to “C/C++”