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 115520 times)

0 Members and 1 Guest are viewing this topic.

Offline eugene

  • Frequent Contributor
  • **
  • Posts: 496
  • Country: us
Re: Python becomes the most popular language
« Reply #550 on: May 03, 2022, 03:17:29 pm »
I know that there are a lot of large, professional-level Python projects out there. But, in terms of number of applications, most Python code is simple stuff, often written by beginners. For that purpose it is sort of the Arduino for programming in that it's easy to learn and there are a huge number of easy to use libraries available that do all the hard work. Is it possible that all of those hobbyists are being counted when it's said that Python is the most popular?

Of course, the fact that the code is often platform independent (without the need for recompiling) helps a lot.
90% of quoted statistics are fictional
 

Offline eugene

  • Frequent Contributor
  • **
  • Posts: 496
  • Country: us
Re: Python becomes the most popular language
« Reply #551 on: May 03, 2022, 03:21:25 pm »


I was not amused.

Clearly the designers went off the rails when they decided that going around in either direction was a good idea. That seems to defeat the purpose of a round about.
90% of quoted statistics are fictional
 

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1033
  • Country: es
    • Picuino web
Re: Python becomes the most popular language
« Reply #552 on: May 03, 2022, 03:43:34 pm »
Is it possible that all of those hobbyists are being counted when it's said that Python is the most popular?

I thought the same thing some time ago. Until I saw this statistic from stack overflow that provides only the data from professionals:

https://insights.stackoverflow.com/survey/2021#section-most-popular-technologies-programming-scripting-and-markup-languages
 

Offline emece67

  • Frequent Contributor
  • **
  • !
  • Posts: 614
  • Country: 00
Re: Python becomes the most popular language
« Reply #553 on: May 03, 2022, 04:04:44 pm »
.
« Last Edit: August 19, 2022, 05:27:55 pm by emece67 »
 
The following users thanked this post: Siwastaja

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1033
  • Country: es
    • Picuino web
Re: Python becomes the most popular language
« Reply #554 on: May 03, 2022, 05:34:05 pm »
I think the same for a college level.

In the other side, for children from kindergarten to high school, the best language invented so far is Scratch. Developed by the MIT Media Lab's Lifelong Kindergarten group (LLK) and based on Google's blockly.

https://scratch.mit.edu/projects/editor/
 

Offline ve7xen

  • Super Contributor
  • ***
  • Posts: 1194
  • Country: ca
    • VE7XEN Blog
Re: Python becomes the most popular language
« Reply #555 on: May 03, 2022, 05:47:24 pm »
IMHO Python is one of the easiest languages for casual programmers and for beginners. I'm not only talking about the language syntax, but being also interpreted is a plus for a newbie. What other language will any use at school? Bash  :phew: ? Perl  :wtf: ? Java  :blah: ? C++  |O ? Maybe Lua is the only contender in such category. In some way Python is the new Basic.

One nice thing about Python in a teaching environment is that it has pretty good support for most programming paradigms. It can be a common thread from scripts to procedural, to OO, to functional programming concepts and can be a comfortable home from beginner to expert. It's also an 'easy' entry point to more high-level concepts like AI/ML, data processing, etc. When I went to college, a lot of time was spent teaching Scheme or Java or whatever else I've now forgotten about just to have an environment to explore a fundamental concept, which wastes at least half the semester on 'boilerplate'. There are other languages that have this property, but Python was one of the first to do it well, and as a popular language is a marketable skill for schools to teach in its own right, though the primary goal of a computer science education is not to teach languages. Alongside C/C++ for data structures and systems, it's all you need.
73 de VE7XEN
He/Him
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15282
  • Country: fr
Re: Python becomes the most popular language
« Reply #556 on: May 03, 2022, 05:49:00 pm »
The increase in popularity of Python I relate it to a greater interest in interpreted languages, because of the advantages of programming in Python to speed up the development of new applications, new features and maintenance, compared to other compiled languages.

IMHO Python is one of the easiest languages for casual programmers and for beginners. I'm not only talking about the language syntax, but being also interpreted is a plus for a newbie. What other language will any use at school? Bash  :phew: ? Perl  :wtf: ? Java  :blah: ? C++  |O ? Maybe Lua is the only contender in such category. In some way Python is the new Basic.

If you want something very simple, Lua is very lightweight, much simpler to learn than Python, and is actually sane. It's also much faster.

"Popularity" of Python is actually the right metric for it. Popularity in general usually feeds itself (until it eventually goes out of fashion, and that can be brutal... I'm curious to see what will happen with Python specifically.) So, it's popular because... it's popular. =) The ecosystem is the major point IMO. People use it because you can find tons of libraries and modules with which you can achieve stuff with just a few lines of code. Not because it's a particularly simple nor elegant language.
 

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1033
  • Country: es
    • Picuino web
Re: Python becomes the most popular language
« Reply #557 on: May 03, 2022, 06:07:00 pm »
Lua is currently ranked number 19 in popularity according to TIOBE, which is not bad at all.
Being so light is also a big advantage. But that itself is a disadvantage by not providing even a minimal standard library.
 

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1033
  • Country: es
    • Picuino web
Re: Python becomes the most popular language
« Reply #558 on: May 03, 2022, 06:16:08 pm »
And what about array limits?

This Lua code:
Code: (lua) [Select]
array = {"Hello", "world"}

for i = 1, 5 do
   print(array[i])
end

returns:
Code: [Select]
Hello
world
nil
nil
nil

I don't think this is a good example for an introductory programming course.
 

Offline eugene

  • Frequent Contributor
  • **
  • Posts: 496
  • Country: us
Re: Python becomes the most popular language
« Reply #559 on: May 03, 2022, 06:42:12 pm »
It's better than a seg fault.
90% of quoted statistics are fictional
 

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1033
  • Country: es
    • Picuino web
Re: Python becomes the most popular language
« Reply #560 on: May 03, 2022, 07:04:45 pm »
Yes, but worst than Python return.

Code: [Select]
array = ['Hello', 'world']
for i in range(5):
    print(array[i])

Return:
Code: [Select]
Hello
world
Traceback (most recent call last):
  File "<pyshell#6>", line 2, in <module>
    print(array[i])
IndexError: list index out of range
 

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1033
  • Country: es
    • Picuino web
Re: Python becomes the most popular language
« Reply #561 on: May 03, 2022, 07:09:13 pm »
But, if you want a null return, is very easy to achieve:

Code: [Select]
array = ['Hello', 'world']
for i in range(5):
    try:
        print(array[i])
    except:
        print(None)

Return:
Code: [Select]
Hello
world
None
None
None
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 9375
  • Country: gb
Re: Python becomes the most popular language
« Reply #562 on: May 03, 2022, 07:12:15 pm »
Clearly the designers went off the rails when they decided that going around in either direction was a good idea. That seems to defeat the purpose of a round about.
If road designers are blatantly confusing drivers, they look bad. So, they find roundabout ways to achieve the same goal.
 
The following users thanked this post: newbrain

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15282
  • Country: fr
Re: Python becomes the most popular language
« Reply #563 on: May 03, 2022, 07:13:22 pm »
Picuino, can you elaborate on what's the problem?

And, Lua doesn't have "arrays" in fact. It only has tables, which are collections of key-value pairs. Tables can loosely act as arrays if they only contain items without an associated key, in which case they get assigned a numeric index. But they still operate as tables.

Accessing an item that doesn't exist in a table yields 'nil', which basically means an object that doesn't exist. Seems consistent to me. Actually, this model looks more sane to me for beginners than the low-level, C-like arrays, which you always can learn about later on once your have your bases covered.

Lua has metatables too, so you can override the indexing function for a given table, and do some fun (or interesting) stuff. You can for instance define tables that will not return 'nil' when accessing an item that doesn't exist, but will do something else entirely. Pretty powerful.

Oh, and otherwise, you have iterators, so you can access tables in a more elegant way than directly indexing them.
 

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1033
  • Country: es
    • Picuino web
Re: Python becomes the most popular language
« Reply #564 on: May 03, 2022, 07:20:50 pm »
Picuino, can you elaborate on what's the problem?

Not much, really.
They are two equally valid points of view.
I see it from the point of view of teaching how important it is not to exceed the limits of an array. The array is the structure most used by other lower level languages that any programmer will later have to learn. Dictionaries (tables) are a different concept and Python distinguishes them well, which for me is an advantage when teaching the different types of data that exist.
 

Offline PicuinoTopic starter

  • Super Contributor
  • ***
  • Posts: 1033
  • Country: es
    • Picuino web
Re: Python becomes the most popular language
« Reply #565 on: May 03, 2022, 07:23:15 pm »
Oh, and otherwise, you have iterators, so you can access tables in a more elegant way than directly indexing them.

Both Lua and Python, but this way you can't get out of the array.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 27881
  • Country: nl
    • NCT Developments
Re: Python becomes the most popular language
« Reply #566 on: May 03, 2022, 07:24:31 pm »
About Lua: I'm surprised it doesn't get that much traction nowadays. I like it far better compared to Python and it is very easy to integrate Lua in applications in order to add scripting.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 9375
  • Country: gb
Re: Python becomes the most popular language
« Reply #567 on: May 03, 2022, 07:31:30 pm »
About Lua: I'm surprised it doesn't get that much traction nowadays. I like it far better compared to Python and it is very easy to integrate Lua in applications in order to add scripting.
Lua certainly shines for scripting. Its such a lightweight add on.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15282
  • Country: fr
Re: Python becomes the most popular language
« Reply #568 on: May 03, 2022, 07:38:38 pm »
About Lua: I'm surprised it doesn't get that much traction nowadays. I like it far better compared to Python and it is very easy to integrate Lua in applications in order to add scripting.

It's pretty easy to integrate in applications indeed, and the bonus is that you can allocate several instances of the Lua interpreter in the same app, whereas I'm not even sure this is possible with Python.

But popularity? Again a complex and intricate matter. Lua comes from a uni in Brazil, and I have no doubt they teach Lua over there.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15282
  • Country: fr
Re: Python becomes the most popular language
« Reply #569 on: May 03, 2022, 08:19:59 pm »
Picuino, can you elaborate on what's the problem?

Not much, really.
They are two equally valid points of view.
I see it from the point of view of teaching how important it is not to exceed the limits of an array. The array is the structure most used by other lower level languages that any programmer will later have to learn. Dictionaries (tables) are a different concept and Python distinguishes them well, which for me is an advantage when teaching the different types of data that exist.

That is debatable to no end. I quite like the unified data collection type in Lua, with which again you can actually implement any data structure you like. This is not restrictive.
Whether accessing an non-existing item returns nil or causes an exception/crash is not a sign of a good implementation per se or what should really be done.

Generalizing data collection is not a bad thing IMO. Beginners certainly do not need to make a difference. What matters is whether the data collection is ordered or not, and this is the key point. Key-value pairs in Lua tables are NOT ordered, but keyless values are assigned a numeric, increasing index, and are ordered. This is really all you need to know. The rest is pretty low-level, and if/when you need to learn about more low-level structures, you can do that later. I'm not sure starting with them is that good of an idea.

Note that print() in Lua will print 'nil' for nil values, but using nil values in arithmetic/string/whatever operation will usually yield an exception too. So if there is an invalid item access, you'll get an exception at some point, unless you explicitely deal with that in the code.

Now you can implement "arrays" that would act as you expect, using metatables. That'd actually be an interesting first exercise for learning about metatables.

Code: [Select]
function NewArray(A)
A = A or {}

return setmetatable(A, { __index = function (Table, Key) error("Out of Bounds!", 2) end })
end

A = NewArray({"Hello", "world"})

for i = 1, 5 do
print(A[i])
end
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 9375
  • Country: gb
Re: Python becomes the most popular language
« Reply #570 on: May 03, 2022, 08:52:45 pm »
About Lua: I'm surprised it doesn't get that much traction nowadays. I like it far better compared to Python and it is very easy to integrate Lua in applications in order to add scripting.
It's pretty easy to integrate in applications indeed, and the bonus is that you can allocate several instances of the Lua interpreter in the same app, whereas I'm not even sure this is possible with Python.
I've seen Lua scripting being used in things like VoIP server applications, where every call has a Lua script running. So, it seems to do a good job when you have a quite a large number of concurrent instances.
 

Offline eugene

  • Frequent Contributor
  • **
  • Posts: 496
  • Country: us
Re: Python becomes the most popular language
« Reply #571 on: May 03, 2022, 10:00:21 pm »
The only reason that I have ever even heard of Lua is because it's the scripting language used in FEMM. I leaarned to use it to get some work done. To that end, I found it easy to learn and capable enough to do what I needed to do. I have always had the vague impression that that sort of thing is exactly what Lua was designed for.

How is comparing Lua to Python to C at all productive without context? I think Picuino is supplying his context when he talks about using Python as a learning tool. I can easily see how it would be well suited for teaching programming concepts without getting distracted by programming details. OTOH, a large fraction of my coding time is spent writing firmware for microcontrollers. There C seems a much more natural fit. Both C and Python win!!!
90% of quoted statistics are fictional
 

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7909
  • Country: nl
  • Current job: ATEX product design
Re: Python becomes the most popular language
« Reply #572 on: May 04, 2022, 07:23:52 am »
Yes, but worst than Python return.

Code: [Select]
array = ['Hello', 'world']
for i in range(5):
    print(array[i])

Return:
Code: [Select]
Hello
world
Traceback (most recent call last):
  File "<pyshell#6>", line 2, in <module>
    print(array[i])
IndexError: list index out of range
Cause this isn't the pythonic way.
Code: [Select]
array = ['Hello', 'world']
for x in array:
    print(x)
See how much easier it is? If you really really need the index, you enumearte it.
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6844
  • Country: fi
    • My home page and email address
Re: Python becomes the most popular language
« Reply #573 on: May 04, 2022, 08:12:37 am »
One possible enumerated version in Python being
Code: [Select]
array = [ 'hello', 'world' ]
for x in range(len(array)):
    print("array[{key}] = '{value}'".format(key=x, value=array[x]))
which outputs
    array[0] = 'hello'
    array[1] = 'world'

As to Lua, I still need to experiment more with LGI and LQT.  The former provides GObject introspection bindings for Lua (and thus one can use e.g. Gtk+ and WebKit in Lua with that, the same way one can use them in Python); the latter provides Lua to Qt5 bindings.  (I'm not interested in microbenchmarking, though.  What matters to me, is finding out any drawbacks and downsides; the types of situations or problems they have performance or other issues with.)

I do love how embeddable Lua is to an application, but I do have some reservations and prejudices about the abstract stack model that Lua uses to exchange data with non-Lua code.  For some things, such an interface works really well; I just have trouble fitting the model to streaming data and concurrent processing with Lua and non-Lua code.  (I'm not saying it cannot be done, I'm only describing the limitations of my current understanding, hopefully explaining why I haven't used Lua more.)
 

Offline bpiphany

  • Regular Contributor
  • *
  • Posts: 133
  • Country: se
Re: Python becomes the most popular language
« Reply #574 on: May 04, 2022, 08:17:21 am »
It's as contrived as example gets, but I would
Code: [Select]
array = ['hello','world']
for index,value in enumerate(array):
    print(f'array[{index}] = {value}')
« Last Edit: May 04, 2022, 08:28:30 am by bpiphany »
 
The following users thanked this post: Nominal Animal


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf