Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pansa2
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
22 ms
·
301.
▲
by
pansa2
2y ago
> No Python evangelist wants to tell users that step 1 of getting up and running with Python is "Install Ruby". True, but the Python community does seem to be coalescing around tools like UV and Ruff, written in Rust. Presuma
302.
▲
by
pansa2
2y ago
> My understanding is it uses the Safari [JavaScript engine] rather than V8 Looks like you’re right. Thanks for clearing up my misunderstanding: I’m not sure why, but I thought Bun was using a custom JS implementation.
303.
▲
by
pansa2
2y ago
Yes, I was about to comment that “there won’t be a Go 2”, but I guess that wasn’t settled when the article was written.
304.
▲
by
pansa2
2y ago
> I've never found myself wanting a type checker Do you still write type hints, but not check them? Or just use dynamic typing as in Python 2? Actually, I guess the first case is really type-hints-as-comments, so isn't substa
305.
▲
by
pansa2
2y ago
So in Ruby, `map` and `select` are eager-by-default, but you can just write `lazy.map().select()` to make the whole chain lazy? That's really nice - much better than Python 2, which was also eager-by-default and you had to change eve
306.
▲
by
pansa2
2y ago
You're right, it's not the same mechanism. But in this particular context it has the same effect - it allows you to define functions in a source file in arbitrary order.
307.
▲
by
pansa2
2y ago
> identifiers in the body of a function aren't resolved until the function itself is executed (if ever) and at the point everything in the module scope has been defined Yes, so within a function you can refer to things that are de
308.
▲
by
pansa2
2y ago
> I'd be surprised if other implementations passed immutable objects by value I'm thinking of MicroPython here - it supports several pointer-tagging schemes, in which "references" might be actual pointers or might i
309.
▲
by
pansa2
2y ago
Lua. Go (especially pre-generics). Even JavaScript is simple, compared to Python. I'd put Python in the second tier of complexity - below C++, but on par with languages like Rust and Swift.
310.
▲
by
pansa2
2y ago
Compared to other languages, Python's biggest shortcomings are in the areas of packaging, performance, and parallelism. Large, complex projects are likely to run into issues with those things that could have been avoided by using a dif
311.
▲
by
pansa2
2y ago
> the compiler only knows about what lexically precedes it. […] it drives programmers to lay out the declarations backwards. The leaf functions come first, and the global interface functions are last. It’s like reading a newspaper artic
312.
▲
by
pansa2
2y ago
You can't change which list `foo` refers to, though. Only the contents of that list. `foo` is a reference to a list, and that reference is passed by value.
313.
▲
by
pansa2
2y ago
> even if the value happens to be a reference to an heap allocated object IIRC in CPython, the value is always a reference to an object. Other implementations might pass immutable objects directly by value, but the semantics is the s
314.
▲
by
pansa2
2y ago
This sort of thing makes me think Python is very complex: What `instance.foobar` actually does: https://blog.ionelmc.ro/2015/02/09/understanding-python-meta... Unless `instance` is actually a class, in which
315.
▲
by
pansa2
2y ago
Sounds like you're looking for... Python? It has tools for checking static types (and the language community strongly encourages their use). Pattern matching was added in version 3.10.
316.
▲
by
pansa2
2y ago
> One parting thought: how long will Python's reign last? Python doesn't really target non-programmers (IIRC the Steering Council is composed entirely of professional developers, who steer the language towards fulfilling thei
317.
▲
by
pansa2
2y ago
> It's simple (or, at least, you can pretend it is, for casual use) I'm glad that caveat is there, because "Python is simple" is one of the biggest misconceptions about the language. It's actually a very comp
318.
▲
by
pansa2
2y ago
They never quite made another model this big, though. The 2000s sets are 42” tube (40” visible) whereas this one is 45” tube (43” visible).
319.
▲
by
pansa2
2y ago
Widescreen? If so it’s likely a Sony GDM-FW900 in disguise - would probably sell for a couple of thousand nowadays.
320.
▲
by
pansa2
2y ago
Shifting an integer left `n` bits is equivalent to multiplying it by `2 ** n`
321.
▲
by
pansa2
2y ago
The title of the article itself has been edited to remove the double negative
322.
▲
by
pansa2
2y ago
And afterwards, because floating-point arithmetic can change the value of the tag. This isn't necessary with NaN-boxing, because it uses NaN bit patterns that the hardware never generates.
323.
▲
by
pansa2
2y ago
> A small minority, but apparently it includes all the floats you’re likely to use. Sorry, I meant a small minority need to be boxed - all the floats you're likely to use can remain unboxed.
324.
▲
by
pansa2
2y ago
> Writing `body: list[AstNode]` lets you statically know what elements you'll get when you do `body[i]` Don't get me wrong, I understand the benefit of the type hint - and if typing `: list[AstNode]` was all it took to get th
325.
▲
by
pansa2
2y ago
> 50% means you only get 1 tag bit. That's enough to distinguish between "unboxed float" and "something else", where the latter can have additional tag bits. > [64-bit] pointers are only 48 bits and you hav
326.
▲
by
pansa2
2y ago
> reconfirm those bits afterwards Thanks - I hadn't thought about that but it seems to be the main downside of this approach. The benefit of NaN-boxing is that it reassigns values that are otherwise unused - floating-point calcula
327.
▲
by
pansa2
2y ago
Type hints encourage this sort of object-oriented design though, in my experience. The resulting code is extremely verbose compared to Pythonic "executable pseudocode". For example, see Jack Diederich's talk "Stop Writin
328.
▲
by
pansa2
2y ago
> Can you imagine a developer in any of those languages complaining that "oh, now the code is messy and unreadable because we added explicit types"? Python used to be described as "executable pseudocode". None of th
329.
▲
by
pansa2
2y ago
> This allows unboxing the vast majority of floats, which leads to big speedups on float-heavy benchmarks. NaN-boxing allows all floats to be unboxed though. The main benefit of the self-tagging approach seems to be that by boxing s
330.
▲
by
pansa2
2y ago
The biggest issue with Python type hints for me isn't the hints themselves, it's that they encourage people to write overly complex, verbose code just to satisfy the type checker. Code like this [0] could simply be 3 functions. In
More ›