Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pansa2
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
25 ms
·
391.
▲
by
pansa2
2y ago
> transpiles them from Python to JavaScript There are projects that do that, but it looks like PyScript instead runs Python code directly. It uses a Python interpreter compiled to WebAssembly - either CPython (from Pyodide) or MicroPyt
392.
▲
by
pansa2
2y ago
https://news.ycombinator.com/item?id=41234863
393.
▲
You should make a new programming language
(ntietz.com)
23 points
by
pansa2
2y ago
|
4 comments
394.
▲
by
pansa2
2y ago
See also: https://news.ycombinator.com/item?id=41187470
395.
▲
by
pansa2
2y ago
Off-topic, but when did Python become so... verbose? From the PEP: def greet(*args: Decoded | Interpolation) -> str: result = [] for arg in args: match arg: case Decoded() as decoded:
396.
▲
by
pansa2
2y ago
Remember that `i` is also a number. As in `for i = 0 to n`. Don’t believe those mathematicians when they tell you that `i` is “imaginary”.
397.
▲
by
pansa2
2y ago
https://news.ycombinator.com/item?id=41207415
398.
▲
by
pansa2
2y ago
When one Python function calls another, does that ultimately result in the CPU executing a `call` instruction, or not? Python 3.11 changed from "yes" to "no" for performance reasons. Lua, OTOH, changed from "no"
399.
▲
by
pansa2
2y ago
One of the performance improvements mentioned is "Remove the usage of the C stack in Python to Python calls" [0]. Since Python 3.11, a Python-level function call can be evaluated within the bytecode interpreter loop, no longer req
400.
▲
by
pansa2
2y ago
One of the casualties of the Python 2 => Python 3 debacle, it seems.
401.
▲
by
pansa2
2y ago
Here's Guido himself expressing FOMO about what would happen if Python stopped continually accumulating new features (specifically including the `match` statement): > Essentially the language would stop evolving. I worry that that
402.
▲
by
pansa2
2y ago
> Don't these things take a massive amount of effort? Yes, RustPython has been in development since at least 2018. > Wouldn't this be making waves much earlier in its development process? It's been posted on HN seve
403.
▲
by
pansa2
2y ago
Lua should be robust in the face of untrusted source code. However untrusted bytecode is unsafe.
404.
▲
by
pansa2
2y ago
> But I could’ve sworn I’d read somewhere that this at least wasn’t suggested Maybe you’re thinking about the use of untrusted bytecode? Loading it is strongly discouraged because that’s insecure - Lua has nothing like a bytecode ver
405.
▲
by
pansa2
2y ago
The `match` statement is the most obvious - its motivation [0] is "pattern matching syntax is found in many languages" and "[it will] enable Python users to write cleaner, more readable code for [`if isinstance`]". But `
406.
▲
by
pansa2
2y ago
> pointless features are added because maintainers are afraid I wouldn't have described language designers' feelings that way, but you're absolutely right. For example, witness the recent features added to Python with li
407.
▲
by
pansa2
2y ago
> I switched from C++ to C about 7 years ago and never looked back I'm definitely considering the same, and you're right - it's not C++ itself that appeals to me at all, it's the libraries. I'm not sure what C
408.
▲
by
pansa2
2y ago
> Some languages do better than others at saying no, and those languages tend to be the ones that achieve widespread adoption. Unfortunately that’s not at all true - Go is a real outlier here. If it were true, we’d all be writing C ins
409.
▲
by
pansa2
2y ago
> types are a godsend for large, and/or long-running projects Agreed. But that doesn't mean that every language needs to be statically-typed, which seems to be where we're heading nowadays. IMO large and/or long-run
410.
▲
by
pansa2
2y ago
> One of the big advantages to type hinting in Python is that it feeds the IDE a lot of information to increase auto-complete functionality Yeah, until this discussion I thought the main benefit of type hints was earlier detection of b
411.
▲
by
pansa2
2y ago
Here's an example of TypeScript failing to be sound - it should give a type error but it doesn't. I believe Flow does indeed give a type error in this situation: https://news.ycombinator.com/item?id=41069695
412.
▲
by
pansa2
2y ago
> javascript resources are written in typescript by default with nothing for regular javascript. This is the same problem that happened when JQuery hit its peak popularity That's definitely a potential issue - JavaScript is the fu
413.
▲
by
pansa2
2y ago
> It's not just comments. It's also a hint for your IDE to display better autocomplete options. Ah yes, autocomplete is another benefit of machine-readable type hints. OTOH there's an argument that another IDE feature, i
414.
▲
by
pansa2
2y ago
> Its better to have no types at all than wrong types. I agree - but the type systems of both Python and TypeScript are unsound, so all type hints can potentially be wrong. That's one reason why I still mostly use untyped Python -
415.
▲
by
pansa2
2y ago
With this approach, do you still use Python's standard syntax for type hints? def mersenne(p: int): return 2**p - 1 Or, given there's no need for the type hints to be checker-friendly, do you make them more human-friendly
416.
▲
by
pansa2
2y ago
If Node.js can run TypeScript files directly, then the TypeScript compiler won't need to strip types and convert to JavaScript - it could be used solely as a type checker. This would be similar to the situation in Python, where type ch
417.
▲
by
pansa2
2y ago
> They solve the same problem but in very different ways. Yes. Async/await is stackless, which leads to the “coloured functions” problem (because it can only suspend function calls one-by-one). Threads are stackful (the whole stac
418.
▲
by
pansa2
2y ago
Are these Virtual Threads the feature that was previously known as “Project Loom”? Lightweight threads, more-or-less equivalent to Go’s goroutines?
419.
▲
by
pansa2
2y ago
> It is an explicit goal of the go team to minimize the number of keywords in the language. It's understandable - because unfortunately people judge languages by very shallow metrics. Several times I've seen people use "
420.
▲
by
pansa2
2y ago
In C#, `yield` is a kind of return, not a function call. The two approaches to iteration are quite different (external vs internal iteration).
More ›