Poll

Do you like Python?

Yes, I love it.
22 (24.2%)
Yes, I like it.
24 (26.4%)
No, I don't like it
17 (18.7%)
No, I hate it.
14 (15.4%)
No opinion, indiferent
11 (12.1%)
I refuse to answer
3 (3.3%)

Total Members Voted: 90

Author Topic: Python becomes the most popular language  (Read 96258 times)

0 Members and 1 Guest are viewing this topic.

Offline bpiphany

  • Regular Contributor
  • *
  • Posts: 129
  • Country: se
Re: Python becomes the most popular language
« Reply #850 on: August 17, 2022, 06:37:48 am »
Simply to show the convenience of it. The cache decorator takes away the step of implementing it yourself each time. It also takes away the need to understand how it works. You learn to work on the abstracted level not in the nitty gritty details. Horses for courses.

Code: [Select]
import functools

@functools.cache
def fib(n):
    return n if n<2 else fib(n-1)+fib(n-2)

for n in range(100):
    print(fib(n))

And yes, we all know there is a closed form for the fibonacci numbers, before anyone goes smart-ass =)

And I'm on the fence about the python ternary syntax...
« Last Edit: August 17, 2022, 06:43:42 am by bpiphany »
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4028
  • Country: nz
Re: Python becomes the most popular language
« Reply #851 on: August 17, 2022, 09:11:06 am »
The question is what would make a good introductory language now? It certainly isn't assembler-lite like CESIL was, but neither is it a language like Python that throws in everything including the kitchen sink and has idiosyncrasies that make it non-representative of programming languages as a whole.

I'm really not convinced that this idea that Python is fundamentally a bad language for introducing Computer Science holds because it 'throws in everything'. The argument seems to be that 1. rigour and 2. lack of alternatives contributes to a language's success as a teaching language. In other words, a language that forces your hand into doing things 'properly', because there simply is no other way. I'm not sure this is actually good for learning the underlying 'whys', though, and actually understanding the fundamental concepts that a computer science education is trying to give you.

My objections to Python:

- the syntax. The most minor of my complaints, but I want it out of the way

- there is toooooo much language to learn. Too many constructs, too many rules. You spend more time learning the language than learning how to use it. Sure, Java and C++ and almost everything else is worse. Scheme, assembly language, and Logo are better. Maybe SmallTalk is better too, but it's weird. Maybe Forth or Postscript.

- there is too much that is magical, that you can't see how it works. Arrays, dictionaries, strings ... all that stuff.

- anyone who learns with Python is going to come out of it with no idea what a pointer is. No idea about memory management using heaps or stacks.

- you can't replicate the magical stuff, make your own version of it. In some cases you can, but it will to 50x slower than what is built-in.

- in general, Python is a language for gluing other people's libraries together, not for writing the libraries. OK, that might be what a lot of people spend their working lives doing, but someone has to know how to write the libraries. And I think that should be anyone with "Computer Science" in the title of their degree. The pure library users can learn that at a trade school, not at a Computer Science degree in a proper university. Or in that one CS paper that people in other subjects have to do.


I think assembly language is good to start with. Not an extremely complex one such as x86_64 or armv8 with manuals several thousand pages thick.  And not something like CESIL. I had to look that up. It's got 14 instructions; an implied accumulator register; as many named (6 char names) variables as you want (implicitly declared); simple I/O and arithmetic; an unconditional jump; branch if negative and branch if zero; named labels with the same naming rules as variables (no way to tell them apart visually). No arrays, no strings (except string literals you can only print), no pointers or concept of a memory array, no subroutines.

I think RISC-V RV32I is an excellent intermediate position. Only 37 instructions, and only half a dozen instruction types in 4 binary instruction formats, as load & JAL share format with ALU immediate and store shares format with conditional branch. You can write *any* kind of program in it. multiply and divide and floating point need library functions, but you can write your own and if you do a good job they can be as good/fast as the standard ones.

Perhaps more importantly, you can tell gcc or llvm to compile any C or C++ (or Rust, ...) program to RV32I, which makes it very easy to incrementally move to another language once you get more advanced, see how things are compiled without getting surprised by instructions you haven't learned etc.

As small as it is, I did an experiment a few weeks ago where I tried to subset RV32I to the bare minimum. I got it down to the 10 most common instructions which can emulate any of the missing instructions efficiently -- no more than 3 or 4 needed. And the missing instructions are mostly relatively rare, statically and dynamically.

I hand-translated a compiled version of my Primes benchmark to this 10 instruction subset, and the code expanded by less than 30% -- and the execution time by much less than that.

You could start people programming using this 10 instruction subset that can be learned in half an hour (5 minutes for the bright ones).

And it does *everything*. Registers and RAM. Pointers and arrays and structs. Stacks and recursive function calls. Objects and virtual functions. You just need to provide some library for I/O and maybe for malloc/free (or implement your own). You can run the resulting programs on emulators or on real, cheap, hardware at full native speeds.

GCC and LLVM could be taught how to use only these instructions. I don't know how easy it would be to get that upstreamed. Maybe too hard.

As the inconvenience of their lack is felt, the missing RV32I instructions can be emulated with a very simple macro facility with I think probably just one dedicated temporary register reserved for it.

My earlier message:

https://www.eevblog.com/forum/microcontrollers/what-is-the-right-way-to-learn-programming/msg4328953/#msg4328953

NB. one of those 10 instructions, NAND, is not in fact a RISC-V instruction. I wanted to get rid of AND/OR/XOR, at least temporarily. They can all be synthesised with 2-4 NANDs, as seen in any digital logic textbook.  NAND could be replaced a bit less conveniently by ANDN (x & ~y), which *is* a RISC-V instruction, in the B extension. You'd have to keep -1 in a register semi-permanently (e.g. load it once in the prolog of any function that needs bitwise instructions) to get a NOT(x) operation by ANDN(-1,x). And NAND(x,y) = ANDN(-1,ANDN(x,ANDN(-1,y))).


Quote
What it also means, more practically, is that such a language will have a narrow scope - it might be suitable for object-oriented programming, but not functional programming, and so on, because that would offer too many choices and the flexibility to do stupid things that don't make sense. This leads to a lot of time and energy wasted on learning the syntax and boilerplate associated with the 'appropriate' language for the given topic, rather than the actual computer science you're there to learn. Instead of computer science, you spend a lot of time learning a handful of languages poorly, and precious little learning concepts (ie. 'programming' and not 'computer science'). In fact, you make this point yourself ('too many introductory courses to programming are introductory courses to programming in language x'),

I agree with all of that.

Quote
so I am surprised that you don't see that the alternative to this is a flexible language like Python that includes the constructs necessary for any sort of programming.

Or assembly language :-)

It would be good to have an assembler with a macro language at least capable of making pseudo-instructions and also boilerplate for assigning register names to local variables and saving callee-save registers in a function prologue (and restoring them at the end). Being able to declare structs and fields in them is helpful too.

IBM mainframes had a really good assembler. Apple copied a lot of it in the MPW assembler in the late 80s, which was capable of implementing Object-Pascal and C++ classes (and subclassing library functions) and virtual functions using macros.

You don't want to take it too far, or you've just reintroduced a lot of complexity to learn. But something a little more than EQU would be nice. Just to ease implementing reasonably complex algorithms and data structures in asm and so postpone moving to C a little.

Quote
I believe that such an education, like any other, should be guided by a teacher, who can introduce the computer science concepts in a natural progressive fashion, while providing feedback and guidance based on the students' choices.

Absolutely. Entirely self-guided learning tends to head off in bad directions.
 
The following users thanked this post: spostma, SiliconWizard

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 7366
  • Country: nl
  • Current job: ATEX product design
Re: Python becomes the most popular language
« Reply #852 on: August 23, 2022, 02:03:15 pm »
https://www.youtube.com/watch?v=RfWGJS7rckk

So John Carmack weights in, and say that the best language is what you are already using.
"You just can't do a loop... reformat it to some vector operation" - this guy get's it. numpy array, list comprehension, and so on. There are so many tools provided to you to write good performing code.
And people "cobble together things that nobody on earth could do 10 years ago"
 

Offline onsenwombat

  • Contributor
  • Posts: 35
  • Country: hk
Re: Python becomes the most popular language
« Reply #853 on: September 07, 2022, 09:16:27 am »
Judging from some opinions I've encountered, one of the leading deciders are whether the person thinks programming being the art form itself, or merely the tool to get their job done. The former typically aren't rooting hard for Python.
Another thing that would have made me rich if I got that famous penny every time I hear it, is how everyone who claims to be a programmer of any kind must know all memory, stack, heap etc. management inside out. While I don't deny that as general knowledge of your industry these would be something to ignore completely, I fail to see how literally every programmer would need to be familiar with these in order to be worth your pay. You are unlikely be writing C-style programs in Python or similar environment anyway, so I fail to see the point how it would improve your practices.
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 2217
  • Country: 00
Re: Python becomes the most popular language
« Reply #854 on: September 07, 2022, 09:58:05 am »
I fail to see how literally every programmer would need to be familiar with these in order to be worth your pay.

In order to be able to decide what is the best tool for the job.
But if your boss decides that for you, that's a different situation...
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 26883
  • Country: nl
    • NCT Developments
Re: Python becomes the most popular language
« Reply #855 on: September 07, 2022, 11:25:30 am »
Judging from some opinions I've encountered, one of the leading deciders are whether the person thinks programming being the art form itself, or merely the tool to get their job done. The former typically aren't rooting hard for Python.
Another thing that would have made me rich if I got that famous penny every time I hear it, is how everyone who claims to be a programmer of any kind must know all memory, stack, heap etc. management inside out. While I don't deny that as general knowledge of your industry these would be something to ignore completely, I fail to see how literally every programmer would need to be familiar with these in order to be worth your pay. You are unlikely be writing C-style programs in Python or similar environment anyway, so I fail to see the point how it would improve your practices.
IMHO you should turn this around: does what you need to implement in software require manipulating memory / hardware at a low level? If the answer is no, then you don't need to bother at all. A problem can only exist if there is an actual problem.

What is a universally good skill to have IMHO is being able to structure a piece of software in a way that it is extendable and malleable so it can be easely modified to support future requirements.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 2217
  • Country: 00
Re: Python becomes the most popular language
« Reply #856 on: September 07, 2022, 02:37:42 pm »
IMHO you should turn this around: does what you need to implement in software require manipulating memory / hardware at a low level? If the answer is no, then you don't need to bother at all. A problem can only exist if there is an actual problem.

In order to answer that question, you need to understand how hardware, compilers and languages work.
Apparently, not many programmers have a deep insight about what happens under the hood, hence the increasing hardware requirements of "modern" software.

So, the question is, do you want to write efficient software that can be used in performance critical applications? If not, use whatever you like.
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 7752
  • Country: de
  • A qualified hobbyist ;)
Re: Python becomes the most popular language
« Reply #857 on: September 09, 2022, 11:28:40 am »
Just a heads-up if you're working with floating point subnormals: Someone’s Been Messing With My Subnormals! (https://moyix.blogspot.com/2022/09/someones-been-messing-with-my-subnormals.html). It involves compiler options and a 10 years old gcc bug report.


 

Offline Ed.Kloonk

  • Super Contributor
  • ***
  • Posts: 4000
  • Country: au
  • Cat video aficionado
Re: Python becomes the most popular language
« Reply #858 on: September 14, 2022, 11:28:36 pm »
Quote
Extending ELS Offering to
Python 2.7 for EL7/EL9

Organizations moving to get ahead of the end of support of Python 2.7 beyond EL7 by mid-2024 timelines need to extend their own product lifecycle and support. Tuxcare ELS for Python is your backport bridge provider.

https://tuxcare.com/extended-lifecycle-support/python
iratus parum formica
 

Offline olkipukki

  • Frequent Contributor
  • **
  • Posts: 790
  • Country: 00
Re: Python becomes the most popular language
« Reply #859 on: September 19, 2022, 11:11:16 pm »
Apparently, not many programmers have a deep insight about what happens under the hood, hence the increasing hardware requirements of "modern" software.

The average most number of software devs  8) think believe aware that: 
 - processing power is infinity
 - memory and storage are unlimited
 - network latency (what is it?) is zero

 
The following users thanked this post: madires, Karel

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Python becomes the most popular language
« Reply #860 on: September 20, 2022, 12:36:48 am »
I'm messing around with Machine Learning (for no good reason other than curiosity) and Python is the way to go.  There are magnificent libraries for AI and they're all free and reasonably well documented.  Yes, it's slower than molasses but it is really easy for a newcomer to experiment with Deep Neural Networks.

I don't care for the syntax but the part I really object to is not knowing the size, shape or contents of a variable.  MyVar can be a string in one part of the program and an int32 a few lines later.  Heck, it could become a matrix of much higher dimension and I might not even know from glancing at the code.

I'm really old; I like Fortran prior to the 2003 version that added objects.  We went to the Moon with Fortran IV and that was always good enough for me.  I started using Fortran IV in 1970 (it was introduced in 1962) and I'm ok with the later versions like Fortran 77 and Fortran 2000.

Fortran 90 has built-in parallel computing as part of the language.  That's nice because Nvidia uses Fortran for CUDA programming.  Why?  Maybe because a lot of the underlying libraries originated in Fortran - like BLAS (Basic Linear Algebra System).  Or, maybe because the physics world and other scientific communities still use it.

And Pascal is prettier than any other language.  As a learning language, it is excellent.  Particularly when coupled with the book "Algorithms + Data Structures = Programs" by Niklaus Wirth.

But Python it is!  The libraries are so plentiful and competent that it just makes sense if you're not in a hurry.


 

Offline Vincent

  • Regular Contributor
  • *
  • Posts: 83
  • Country: ca
  • May or may not be a Tektronix fanboy
    • The Vince Electric Laboratory
Re: Python becomes the most popular language
« Reply #861 on: September 20, 2022, 01:32:11 am »
I've got nothing against Python specifically, but if programming turns into some sort of "black box magic", this pesky brain of mine won't retain much of the knowledge.

In fact, this video sums it up pretty much perfectly:
https://youtu.be/m4-HM_sCvtQ

(I still don't know that "public static void main string args" by heart LOL)

Destiny brought me to C somehow, and while I needed a little break at some point, learning that language (for the most part) came with a largely deeper understanding of computers. So whenever some of my shitty code doesn't work, I have to dig deep enough to figure out exactly why it doesn't work.

And now I'm considering taking a 8048 uC from my junk parts and build some sort of "development" board so that I can mess with assembly a little and truly understand what the hardware does.

It's almost like I already know lean code, bare metal and low-level shit are my thing.  8)
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 2217
  • Country: 00
Re: Python becomes the most popular language
« Reply #862 on: September 20, 2022, 06:14:40 am »
Apparently, not many programmers have a deep insight about what happens under the hood, hence the increasing hardware requirements of "modern" software.

The average most number of software devs  8) think believe aware that: 
 - processing power is infinity
 - memory and storage are unlimited
 - network latency (what is it?) is zero

 - all monitors have the same size & resolution
 
The following users thanked this post: Ed.Kloonk, madires, JPortici

Offline madires

  • Super Contributor
  • ***
  • Posts: 7752
  • Country: de
  • A qualified hobbyist ;)
Re: Python becomes the most popular language
« Reply #863 on: September 20, 2022, 09:37:41 am »
The average most number of software devs  8) think believe aware that: 
 - processing power is infinity
 - memory and storage are unlimited
 - network latency (what is it?) is zero

AKA The Cloud. ;D
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14440
  • Country: fr
Re: Python becomes the most popular language
« Reply #864 on: September 20, 2022, 06:24:44 pm »
Well, software development is one of the rare activities which are not told to become "frugal" these days. That's fascinating.
 

Offline temperance

  • Frequent Contributor
  • **
  • Posts: 442
  • Country: 00
Re: Python becomes the most popular language
« Reply #865 on: September 20, 2022, 07:46:19 pm »
It's official. I'm depressed now that my carefully and meticulously acquired C, C++ skills are on the line.

Being close to France, I will spend my heard earned money on some whine today while I make up a plan for the future.

Some options:
-Apply for the fire brigade. Smoke is smoke and fire is fire.
-Become a priest. The bible didn't change in 2022 years. No discussion about that and brewing beer and making cheese is not that bad.
-Start to design tube amplifiers with ancient noisy resistors because they are good.
-Cleanup my workbench after 22 years of intensive use. That will take an other 22 years.
-Create polls on programming languages and ask embedded system programmers which language they use. Very unexpectedly C dug itself out of a slump and became the most popular programming language known to man.

I feel better now.

Tools are tools. Use the tool appropriate for the requirement.
Some species start the day by screaming their lungs out. Something which doesn't make sense at first. But as you get older it all starts to make sense.
 

Offline MikeK

  • Super Contributor
  • ***
  • Posts: 1314
  • Country: us
Re: Python becomes the most popular language
« Reply #866 on: September 20, 2022, 08:36:25 pm »
Python is slow, inefficient, interpreted code.  C/C++ skills are not on the line.  Unless, of course, the lazy ignorant generation winds up making key decisions...then it's a crapshoot.
 

Offline jfiresto

  • Frequent Contributor
  • **
  • Posts: 807
  • Country: de
Re: Python becomes the most popular language
« Reply #867 on: September 21, 2022, 07:31:54 am »
Python is slow, inefficient, interpreted code....

CPython compiles Python source code into byte code, and then executes the byte code in a virtual machine. Has anyone implemented the CPython virtual machine in hardware?
-John
 

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2328
  • Country: 00
« Last Edit: September 21, 2022, 10:29:28 am by ebclr »
 

Offline Just_another_Dave

  • Regular Contributor
  • *
  • Posts: 192
  • Country: es
Re: Python becomes the most popular language
« Reply #869 on: September 21, 2022, 02:06:43 pm »
Python is slow, inefficient, interpreted code....

CPython compiles Python source code into byte code, and then executes the byte code in a virtual machine. Has anyone implemented the CPython virtual machine in hardware?

FPGA accelerated python could be an interesting experiment. Does anybody know if python byte code is consistent between CPython versions?
 

Offline ve7xen

  • Super Contributor
  • ***
  • Posts: 1192
  • Country: ca
    • VE7XEN Blog
Re: Python becomes the most popular language
« Reply #870 on: September 21, 2022, 04:52:28 pm »
FPGA accelerated python could be an interesting experiment. Does anybody know if python byte code is consistent between CPython versions?

The bytecode isn't intended to be stable, and is considered an implementation detail (ie. it is part of CPython, not the Python Language). So while I'm not sure how stable it has been in practice (my guess would be 'not very'), it wouldn't be a good idea to target hardware at it as anything other than a curiosity.
73 de VE7XEN
He/Him
 

Offline jfiresto

  • Frequent Contributor
  • **
  • Posts: 807
  • Country: de
Re: Python becomes the most popular language
« Reply #871 on: September 21, 2022, 05:12:45 pm »
Python 2.7 is stable.  8)
-John
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14440
  • Country: fr
Re: Python becomes the most popular language
« Reply #872 on: September 21, 2022, 05:54:00 pm »
Python 2.7 is stable.  8)

It's as stable as Windows XP. So you're not supposed to use it. ;D
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14440
  • Country: fr
Re: Python becomes the most popular language
« Reply #873 on: September 21, 2022, 05:59:13 pm »
Python is slow, inefficient, interpreted code.  C/C++ skills are not on the line.  Unless, of course, the lazy ignorant generation winds up making key decisions...then it's a crapshoot.

Of course they aren't. There will still be demand for C long after Python has died. I could bet on that.

Sure there is *proportionally* less demand, but for higher-paid jobs and a lot less competition. Up to you to choose kind of a niche or to compete with potentially millions of Python "developers", a fraction of which will code for $5/hr.
 

Offline Ed.Kloonk

  • Super Contributor
  • ***
  • Posts: 4000
  • Country: au
  • Cat video aficionado
Re: Python becomes the most popular language
« Reply #874 on: September 22, 2022, 06:47:29 am »
There will still be demand for C long after Python has died. I could bet on that.

That's a big call, man. I wonder what you'd be prepared to bet. Your left ball?
iratus parum formica
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf