News for hackers. Stuff that matters.
Re:Python 3.11 in the Web Browser by cgb223 on Saturday March 26, 2022 @08:56PM (#30816745)
Couldn’t browsers theoretically “bake in” the python.org binary to the browser itself to avoid this?

Kind of like how macOS (used to) ship with python preinstalled?

Re:Python 3.11 in the Web Browser by toastal on Saturday March 26, 2022 @10:08PM (#30817125)
If browsers already have a multi-paradigm, dynamic/duck-typed, garbage-collected scripting language in JavaScript, why would they add another one--especially since JS is incredibly backwards-compatible to not break the web? In the broader scope of programming languages, Python and JS are the same thing. If their going to add a second language, the least they could do is make it interesting in comparison.
Re:Python 3.11 in the Web Browser by bb88 on Sunday March 27, 2022 @12:19AM (#30817672)
Javascript will be 30 years old in 3 years. It's been successful, sure, but it's also been controversial and a lot of language mistakes have had to be carried forward. The 5 minute "wat" talk still lingers in my head about those basic mistakes.

"Oh they fixed that in Typescript."

But they could have fixed it with practically any other language as well.

Re:Python 3.11 in the Web Browser by asiachick on Sunday March 27, 2022 @01:44AM (#30817993)
The Wat talk is mostly BS for laughs. It's hilarious but to someone familiar with the language it's a bunch of stuff you'd mostly never run into. Some are even outdated.

Like he makes fun of the fact that Array(16).toString() prints 15 commas. In the context of the talk it's funny but in reality, what would you expect. You made a array with 16 empty elements. Array.toString() calls toString() on each element and separates them by commas. Why is that unexpected?

He then shows Array(16).join("wat") which is the same as the previous except JS uses "wat" between elements instead of ","

"wat" + 1 is string + number coerced to string so string + string. string + is defined as concatenation

"wat" - 1. There is no override for - for a string so numeric minus tries to add a string to a number and returns NaN. Ok, why is that unexpected? When will this bite you. You shouldn't be adding numbers to string or strings to numbers. I've been programming JS for ~20 years, I don't remember running into any of these issues.

I've also never tries to add to arrays, add an object and an array, add an array and an object, nor add 2 objects. It's funny that the language does something but so what.

You wanna talk about a language that sucks try bash. Meanwhile I've had no problems shipping 100s of projects in JS. (also, C, C++, C#, perl, python, assembly, others)

Re:Python 3.11 in the Web Browser by lenkite on Sunday March 27, 2022 @09:49AM (#30820213)
> Javascript will be 30 years old in 3 years

Python is already >31 years old.. Python is even older than Java. It is so slow - can barely crawl compared to other languages. Maybe we should retire grand-daddy Python ?

Re:Python 3.11 in the Web Browser by bb88 on Sunday March 27, 2022 @04:12PM (#30823646)
Or maybe just have google invest resources to make it faster like they did with JS?
Re:Python 3.11 in the Web Browser by nine_k on Sunday March 27, 2022 @12:15AM (#30817659)
On top of it, JS is significantly faster.
Re:Python 3.11 in the Web Browser by bb88 on Sunday March 27, 2022 @12:20AM (#30817676)
Faster than what?

JS was considerably slow until Google decided to spend resources to make it faster.

Re:Python 3.11 in the Web Browser by nine_k on Sunday March 27, 2022 @02:13AM (#30818139)
Current standard JS runtimes (e.g. V8) are faster than current standard Python runtimes (such as CPython).

Not that Python can't be made faster (though many architectural decisions of the language resist it), but it hasn't been so far, so there's little incentive to include it to a browser. It gives too little new capabilities, on top of JS.

OTOH, say, WASM gave many new capabilities, and has been included.

Re:Python 3.11 in the Web Browser by kumarvvr on Saturday March 26, 2022 @09:47PM (#30817030)
Yes. It absolutely can. And it would be even more efficient than using WASM. However, I guess adding a new language would introduce a lot of security issues and what not.
Re:Python 3.11 in the Web Browser by liftm on Sunday March 27, 2022 @01:45AM (#30817997)
This is what https://decentraleyes.org/ does, right?