On Mon, Feb 15, 2021 at 02:12:03AM +1100, Chris Angelico wrote:
> On Sun, Feb 14, 2021 at 8:42 PM Steven D'Aprano <st...@pearwood.info> wrote:
> > We should not choose the more confusing, error-prone solution out of
> > fear of being different. Python is already different from Javascript in
> > every regard:
> >
> 
> Is it really?

Well, they're both Turing Complete, so I guess not different in *every* 
regard :-)

By the way, I'm not judging the differences.


> > - the basic execution model is different;
> Don't know what you mean here, but I thought they were the same.

Python has a purely dynamic execution model; Javascript has a hybrid 
two-pass model that combines elements of static and dynamic execution, 
and which allows code like this to run:

    print(f(3));

    function f(a) {
      return a*2;
    }


(not in an interactive REPL of course).

Although both Python and Javascript have dynamic typing, Python's 
type model is stronger (i.e. stricter) than Javascript's.

    1 + '2'  # an error in Python, 12 in Javascript.

In Python, every thing is an object; in Javascript, some things are 
objects, and some things are primitive values.


> > - the object model is different;
> Same object model.

Absolutely not. Javascript is based on the prototype object model, and 
Python is based on the class object model.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain


> > - the numeric model is different;
> Python has more data types, but that's not as fundamental a difference
> as you might think

Python has a numeric tower; Javascript has a single floating point type. 
It's hard to build a tower with a single brick :-)


> >  -the truthy/falsey model is different;
> There are different rules about WHAT is truthy/falsy, but, again, the
> differences aren't fundamental

The differences are precisely my point.


> > - the syntax is different;
> > - the list of keywords is different;
> > - the standard library is different;
> > - the list of operators is different;
> Well, of course. If these four were the same, they'd be the same
> language. These four differ between Py2 and Py3 too.

Yes, the fact that they are different languages is my point.


> > - even basic equality is different;
> Yes, although that's more historic than anything else - most people
> use "===" which has mostly the same semantics as Python's equality

"Mostly the same", apart from being completely different :-(

Javascript's === tests for "same type and equal" for primitive values, 
and is equivalent to Python's `is` for objects. It cannot be overloaded.


> > - the culture of the community is different.
> TBH neither community has a single culture.

Of course neither group of people is a monoculture of identical 
clones. That would be the Haskell community *wink*

But in general, the JS/Node.js community embraces practices which are 
rejected by the Python community, such as the use of micro-packages. 
Remember left-pad?

This four-line package got nearly fifty million downloads last week:

https://www.npmjs.com/package/isarray

That's about 78 times per second.

If I published that on PyPI, I would be amazed if I got 78 downloads in 
a year.


-- 
Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/7RDIPZDPOZUU7AD5JFE2BNQH75OAAGS7/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to