Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pansa2
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
45 ms
·
421.
▲
by
pansa2
2y ago
What's the rationale behind Go choosing internal iteration (the iterator calls a function for each value, like Ruby) over external (the iterator returns each value, like Python and C#)? My understanding is that internal iteration makes
422.
▲
by
pansa2
2y ago
Defining a Go iterator is similar to defining a Python decorator that takes an argument. Both involve defining a function that returns another function, with the inner function having another function as its parameter. This isn’t a particul
423.
▲
by
pansa2
2y ago
> one of the corporations that usurped Python-dev Man, that phrase perfectly encapsulates so much of Python’s evolution over the last ~10 years.
424.
▲
by
pansa2
2y ago
> I think the fast and loose style that Python enables is perfect for small scripts and one off data science notebooks and the like. Agreed - I only use Python for scripts like this, preferring statically-typed, AOT-compiled languages
425.
▲
by
pansa2
2y ago
Python may well have been the right choice for companies like that when they were starting out, but now they're much bigger, they would be better off with a different language. However, they simply have too much code to rewrite it all
426.
▲
by
pansa2
2y ago
> Yes, absolutely, and yes, absolutely. Fair enough, that's a valid philosophy, and one in which `async`/`await` makes perfect sense. However, it's not Python's philosophy - a language with dynamic types, unchecked
427.
▲
by
pansa2
2y ago
Yes, this is similar to how Go works. IIRC the same approach was available in Python as a library, “greenlet”, but Python’s core developers rejected it in favour of `async`/`await`.
428.
▲
by
pansa2
2y ago
No-GIL Python is still interpreted - single-threaded performance is slower that standard Python, which is in turn much slower than the languages you mentioned. Maybe if you’ve got an embarrassingly parallel problem, and dozen(s) of cores
429.
▲
by
pansa2
2y ago
> when you replace the word "aync" with something like "expensive", or "does network calls", it becomes clear that "async/await" makes intrinsic properties about your code explicit rather tha
430.
▲
by
pansa2
2y ago
I think Ruby does? IIRC its source code includes a 10,000+ line “parse.y” file which is converted to C code using Yacc.
431.
▲
by
pansa2
2y ago
Engineering a Compiler (Cooper and Torczon) seems to be widely recommended. I’ve got the second edition but there’s now a third - not sure how significant the changes are. AFAIK the problem with the dragon book is the same as with most acad
432.
▲
by
pansa2
2y ago
Popularity
433.
▲
by
pansa2
2y ago
Ah, `i += 1` isn’t currently thread-safe because Python does (LOAD, +=, STORE) as 3 separate bytecode instructions. I guess the only things that are a single instruction are some modifications to mutable objects, and those are already heavy
434.
▲
by
pansa2
2y ago
PEP703 explains that with the GIL removed, operations on lists such as `append` remain thread-safe because of the addition of per-list locks. What about simple operations like incrementing an integer? IIRC this is currently thread-safe beca
435.
▲
by
pansa2
2y ago
Thanks, there are many more there than I expected!
436.
▲
by
pansa2
2y ago
Doesn’t Luau require a custom Lua implementation though? Is that implementation easily embeddable like the regular Lua VM?
437.
▲
by
pansa2
2y ago
Oh, interesting. Thanks!
438.
▲
by
pansa2
2y ago
QuickJS is presumably intended for embedding within applications - how does it compare to Lua for this? Both languages are fairly quirky - at least JavaScript’s quirks are widely-known. But how do the implementations compare in terms of A
439.
▲
by
pansa2
2y ago
Sanity? No. Would you like in insane [0], FOMO-induced, Zen-contradicting `match` statement instead? [0] https://news.ycombinator.com/item?id=26082225
440.
▲
by
pansa2
2y ago
Does this add support for multiple-statement lambdas? IMO lack of support for them (because of the lack of a good syntax) is the main downside of Python’s significant indentation.
441.
▲
by
pansa2
2y ago
I agree with the other comments - f-strings are worth using. Other than that, um, underscores in numeric literals are nice, especially for hex and binary. I don’t think there’s anything else there that I want to use. But, I recognise that a
442.
▲
by
pansa2
2y ago
> Python is really like C++ now Yet there is still a common belief among programmers that “Python is a simple language”. I don’t know how that persists. Perhaps what people really mean is just that it has “friendly” syntax (no braces,
443.
▲
by
pansa2
2y ago
“Even if the official bytecode verifier was not implemented in Lua 5.2.1, Factorio developers seem to have implemented their own in an attempt to protect the Lua interpreter”
444.
▲
by
pansa2
2y ago
Correct. From the Lua 5.2 manual [0]: "all functions that load code are potentially insecure when loading untrusted binary data. [...] When in doubt, use the mode argument of those functions to restrict them to loading textual chunks.&
445.
▲
by
pansa2
2y ago
> Python […] runs laps around Ruby any day Is today’s Python much faster than, say, 5 years ago? Ruby was definitely quicker than Python back then. I’ve heard of performance improvements to Python, but they seem to be 10-25% range whic
446.
▲
by
pansa2
2y ago
WPO?
447.
▲
by
pansa2
2y ago
> positioning your project as an alternative implementation of something is a losing proposition > don’t go trying to create a subset of Python I agree - a project that's marketed as "Python but with more X " is al
448.
▲
by
pansa2
3y ago
I also read that Capcom USA felt the name “Vega” was too “weak” for the dictator.
449.
▲
by
pansa2
3y ago
Note the top comment by “ark” - there’s really no perfect solution here. In the floating-point case, you have to choose between negative remainders or potentially inexact results. And you definitely want integer division to work the same as
450.
▲
by
pansa2
3y ago
Thanks. Is that behaviour new to Windows 11? I’ve never seen it on Windows 10.
More ›