Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pansa2
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
60 ms
·
841.
▲
by
pansa2
6y ago
Walrus operator: not even once.
842.
▲
by
pansa2
6y ago
The syntaxes of those languages are fundamentally different from Python’s. They don’t have an “expressions may not contain statements” rule - they don’t even have statements.
843.
▲
by
pansa2
6y ago
In fact, no statements at all - just a single expression.
844.
▲
by
pansa2
6y ago
And no tail-call optimization.
845.
▲
by
pansa2
6y ago
I don’t think this limitation is likely to change - the only ways to allow whitespace-sensitive statements inside an argument list are all really ugly.
846.
▲
by
pansa2
6y ago
Until very recently, Python’s grammar was strictly LL(1), so the parser couldn’t handle, for example, `(x, y) => x * y`. Perhaps with the move to a PEG parser, this syntax could now be supported?
847.
▲
by
pansa2
6y ago
Python’s `lambda` can only contain a single expression. There’s no good way to add support for full anonymous functions to Python’s grammar. One of the rules that makes significant-whitespace work elegantly is that statements can contain ex
848.
▲
by
pansa2
6y ago
> Python 3000 effort itself as wanting to insist "everything is Unicode" How does Python 3 handle these HTTP headers and other things that are purely ASCII? Does it treat them as type `bytes` instead of (Unicode) `str`?
849.
▲
by
pansa2
6y ago
> Python in general has gone from being “executable pseudo code” to a series of complex language design trade offs Agree with this 100%. > because it had failed to grasp the right abstractions in its evolution. I'd be interes
850.
▲
by
pansa2
6y ago
Yeah, there seem to be a number of special cases. The rules for the trailing `=` case are particularly complicated: {x=} -> "x="+repr(x) {x=:.2f} -> "x="+format(x, ".2f") {x=:} -> "x
851.
▲
by
pansa2
6y ago
Even if logging can't use f-strings, is there a reason it can't use `string.format`? Limiting logging to `%`-formatting seems to be an inconsistency similar to supporting `%` but not `format` on `bytes` and `bytearray`.
852.
▲
by
pansa2
6y ago
I quite like the idea of using double-quotes for format strings and single-quotes for normal strings. This isn’t sufficient on its own, though - what about raw strings? Perhaps use “” for format strings, ‘’ for raw strings and get rid of no
853.
▲
by
pansa2
6y ago
Making f-strings the default was discussed at the Python Language Summit last year: https://pyfound.blogspot.com/2020/04/all-strings-become-f-st...
854.
▲
by
pansa2
6y ago
V8 and the Julia compiler work in quite different ways - because they solve quite different problems. In particular, Julia’s compiler only works well on code that is "type-stable", whereas V8 has no such limitation.
855.
▲
by
pansa2
6y ago
> prototyped in Python, then ported to C++ This need to rewrite, of course, is what Julia is trying to avoid. My workflow is exactly the same, and I’d love to be able to write code in a high-level language like Python and then use that
856.
▲
by
pansa2
6y ago
I don’t know whether Julia will succeed as a general-purpose language, but its design seems ideal for numeric code. In particular, multiple dispatch makes operator overloading so much nicer than Python’s fragile “dunder” methods like `__add
857.
▲
by
pansa2
6y ago
The OP has re-used the title of an unrelated article posted a few days ago, for some reason: https://news.ycombinator.com/item?id=25726068
858.
▲
by
pansa2
6y ago
> Use the right tool for the job. Do you agree with the article's recommendation of Rust for command-line tools, or do you think Go is the right tool for that job as well? Or perhaps I should stick with C++? For one thing, it'
859.
▲
by
pansa2
6y ago
IMO Lua's main strength is its implementation, not the language itself. Compared to Python, it's more performant, lightweight, portable and robust [0]. Unfortunately, the language itself is "quirky" at best. Its has unus
860.
▲
by
pansa2
6y ago
> If you are making an application from scratch using just the stand-alone interpreter, your scripts and a bunch of dependencies from the internets, use Python. People work really hard to make this semi-viable in Lua, but it is a path o
861.
▲
by
pansa2
6y ago
Do you think presenting the conclusion up-front could detract from the “story-telling” of the piece? By walking the reader through the investigation and its findings in chronological order, perhaps the article aims to make the reader feel l
862.
▲
by
pansa2
6y ago
I sometimes write articles describing investigations similar to this one. Do you think this article’s structure is appropriate? Or would it be better to reduce the need for comments like this one by putting the conclusion much earlier in th
863.
▲
by
pansa2
6y ago
> your program is only fully type checked when all code paths are executed. The solution to this is to make sure that, during testing, all code paths are executed. And that’s something you should be doing anyway, to find bugs that aren
864.
▲
by
pansa2
6y ago
PEP8 recommends using `if seq:` instead of more verbose alternatives like `if len(seq):`.
865.
▲
by
pansa2
6y ago
> bool(Array(False, False)) would evaluate to True Isn't that consistent with the built-in `list`, though, because `bool([False, False])` is True?
866.
▲
by
pansa2
6y ago
> One of my favourite lecturers at Oxford. Same here. I was part of a room full of brand-new undergraduates to whom Dr Neumann did an excellent job of explaining Real Analysis - something that few senior fellows would have been willing
867.
▲
by
pansa2
6y ago
Primarily a lack of time, but also a lack of focus. I’ve never found one single project that fulfils everything I’m looking for, so am currently dividing what time I have between two: - A website about video games that I love to work on - b
868.
▲
by
pansa2
6y ago
What makes Artichoke more suitable than MRI for compilation to WebAssembly (and for embedding, and for single-binary distribution [0])? Is it just that Artichoke is written in Rust? Or does it make different trade-offs in its design? [0] h
869.
▲
by
pansa2
6y ago
> For example, if we define the __add__() special method on an existing class, it will set the nb_add slot of the class to the default implementation that calls the method. See also this post from 2014, which argues that this is a bad
870.
▲
by
pansa2
6y ago
Those are both stack-based.
More ›