[Tutor] (Convergence && Divergence) || Nonsense

avi.e.gross at gmail.com avi.e.gross at gmail.com
Sat Aug 20 14:31:28 EDT 2022


This forum includes many kinds of people new to python that come from little
or no programming experience to those with plenty but in other programming
languages with a mixture of wildly different premises and histories.

 

Those who mainly interact and comment and provide guidance or answers tend
to be knowledgeable about python but many or perhaps all can also recognize
and program in an assortment of other languages.

 

So sometimes we may see discussions here that boil down to trying to correct
ideas of how python ought to do things based on anything from intuition to
how some other language seems to do it to asking how one does something in a
pythonic way that clearly must be doable, but want to know what methods are
available.

 

Recently I mentioned JavaScript in context and Dave made clear his opinions.
Since he and I (and as mentioned others here) are in many senses
multilingual, we often have excellent reasons behind our opinions but it is
a bit out of the rules here to discuss another language except in a narrower
sense as in how the python way is better (or worse) for some scenarios.

 

What I was starting to say was not that I was LEARNING JavaScript but
reading a fairly NEW book that not only refreshes my vague recollections
(mixed is an the language is with by now hundreds of others) but talks about
serious recent changes and updates.

 

I look at the changes and what may have motivated them as well as what is
now deprecated or even forbidden or missing just as I do with python and
other languages. 

 

What I am especially looking for is whether features deemed BAD for various
reasons are being fixed or corrected or replaced by something else.

 

My reading so far indicates that if Dave were to read the same book (or do
his own study) he might be interested. I see many added or changed features
that indicate emulation and borrowing between languages and places where
some very loose features that may be easy to use but lead to all kind of
(sometimes subtle) errors are in some ways reined in. Features I normally
associate with the first language I encountered it in, sometimes turn out to
have been started elsewhere and somewhat copied but also get adopted by
others. A very loose and almost non-existent object-oriented set of
abilities can be expanded so more full-blown objects can be constructed,
alongside the rudimentary objects that often cannot quite go away because of
backward compatibility. JavaScript has added something like iterator
functions which I associated with python but also various asynchronous
methods and functions some of which may be done differently in python now
but for all I know may at some point be adopted.

 

The above is relatively amorphous so I will end with a more concrete
question.

 

Is Python likely to move into some areas like web browsers where JavaScript
is a major built-in with JAVA (completely unrelated) also has some ability
to be integrated? I heard somewhere they once tried to include some of
python in Mosaic but JavaScript sort of won that battle. Mind you, this was
a very EARLY and deficient version of Python.

 

So, aside from issues like getting everyone to change, is there anything
about Python that would be incompatible from being used in browsers either
instead of or alongside JavaScript and be able to access and manipulate the
DOM and other allowed services?

 

I am NOT saying Python is ideal for the role but if it continues to be true
that JavaScript, even changed, has huge deficiencies, would it make sense to
get more bloated browsers where multiple scripting languages can be
embedded. I look at many models out there where people have created
environments (as in the RSTUDIO I mentioned) where multiple languages can be
used alongside each other or even intertwined. I thing at this point you can
embed JavaScript in HTML with a <SCRIPT>.</SCRIPT> snippet or by importing
from a file and a Java applet in <APPLET> or PHP using <?Php . ?> or
something like that. 

 

There seems to be a sort of bootstrap called Brython that perhaps is one
road in: https://realpython.com/brython-python-in-browser/

 

But do note a detail. JavaScript has no IO built-in at least in some sense.
In browsers you can only write to a console with console.log() or perhaps
pop up an alert. You are not allowed to read or write files any time you
feel like it on the users computer, except through controlled interface for
storing local data in restricted ways. If you use Javascript on a server, as
in Node, you get other forms of I/O attached that let you do what is needed.

 

A Python running within a browser would likely also need some surgery to
remove abilities and prevent malicious actors from using it as a trojan
horse.

 

Just to make sure of my main point, languages started off often by diverging
but as they converge, often some of their differences become less and easy
to get around. It may become very hard to explain why you insist on a
specific language when all the others also have grown up. 



More information about the Tutor mailing list