Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pansa2
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
32 ms
·
541.
▲
by
pansa2
5y ago
Does Swift have a GIL? If not, how does it solve the problem of multithreaded reference counting?
542.
▲
by
pansa2
5y ago
> am I going to choose Python? IMO most of the additions to Python in the past decade haven’t been aimed at people choosing a language, but at people working on large existing Python codebases who have too much inertia to change lang
543.
▲
by
pansa2
5y ago
Is CPython the only widely-used language implementation that uses reference counting rather than tracing garbage collection? IIRC even PyPy and MicroPython use tracing GC.
544.
▲
by
pansa2
5y ago
Interesting to contrast this paper’s opinion of significant indentation (“detrimental cleverness”) with “I will never again voluntarily use a language without mandatory indentation for teaching novice programmers”. http://okasaki
545.
▲
by
pansa2
5y ago
> most explicit declarations would be boring and pointless Not pointless - in similar languages (e.g. JavaScript's `let` and Lua's `local`), although declarations don't indicate a variable's type, they do indicate i
546.
▲
by
pansa2
5y ago
> Students have enough trouble mentally separating the concepts of declaration and usage I wonder if this is an argument in favour of Python’s implicit declarations (“there are no declarations, only usages”) or against them (“there are
547.
▲
by
pansa2
5y ago
> Each thread has its own Janet heap, which means threads behave more like processes that communicate by message passing. https://janet-lang.org/docs/threads.html Janet doesn’t seem to have shared-memory multithre
548.
▲
by
pansa2
5y ago
It’s an easy language to learn the basics of, sure. But the complexity of things like attribute lookup doesn’t only affect language implementors. The complexity is all exposed to Python programmers, which makes the language hard to master
549.
▲
by
pansa2
5y ago
Almost certainly. Lua’s source => bytecode compiler also fits that description.
550.
▲
by
pansa2
5y ago
> I find the C# way of having a string.Join(sep, ...) instead of python's "some string".join(...) nicer to read because it's more obvious. `str.join(sep, ...)` works in Python as well, because `a.f(...)` and `type(a
551.
▲
by
pansa2
5y ago
Good article, thanks. It's worth pointing out that the summary (class hierarchy data descriptor > instance `__dict__` > class hierarchy other) only applies when looking up a normal attribute on a normal object: * Special-method l
552.
▲
by
pansa2
5y ago
> Senegal is compiled and Wren is interpreted Senegal seems to use a bytecode interpreter: https://github.com/SenegalLang/Senegal/blob/22fe863ad234e43a...
553.
▲
by
pansa2
5y ago
Decorators are very simple. I'm not surprised that there's not much documentation about them - there's just not much to say. @decorator def f(...): ... is equivalent to: def f(...): ... f = decorator(f)
554.
▲
by
pansa2
5y ago
> `sort(arr)` returns a sorted copy of the input > `sort!(arr)` returns the sorted original Python has a naming convention as well: `sorted(arr)` returns a sorted copy and `arr.sort()` works in-place (and returns None). However, I
555.
▲
by
pansa2
5y ago
> Attribute lookup in Python is [...] an enormous tar pit Spot on. Python is widely described as a simple language, but the complexity of attribute lookup is one thing that shows that's not true at all. Many things in Python are
556.
▲
by
pansa2
5y ago
I believe list comprehensions would be much more readable if they were written the other way round: [for x in [for s in strList: if isNumeric(s): parseInt(s)]: if x != 0: x] Nesting them is still ugly, but can often be avoided usin
557.
▲
by
pansa2
5y ago
> Map,reduce,filter,etc. could simply be added to the iterable base class Surprisingly, Python doesn't have an iterable base class! `list.__bases__` is just `object`.
558.
▲
by
pansa2
5y ago
> So engineers only have one language to absolutely master. I'm always amazed at the reluctance of developers to learn and use multiple languages. To use an old analogy: they're like carpenters who are unwilling to learn how
559.
▲
by
pansa2
5y ago
> Software-isolated processes Is it true that this idea is dead nowadays, because of Spectre-style attacks?
560.
▲
by
pansa2
5y ago
> `x = max(x, 3)` to demonstrate Python's muscles in terms of useful builtins Even Lua has a built-in `math.max` function that works with integers. Maybe it’s Lua’s way of flexing on Go :) > About lambda syntax, to me it would
561.
▲
by
pansa2
5y ago
AFAIK subinterpreters are similar to multiprocessing in that the interpreters don't share memory - but because they are within the same process, communication between them can be more efficient.
562.
▲
by
pansa2
5y ago
`if x < 3: x = 3` is valid Python, although I see your point - you could add an `else` to the Lua example but Python would require a second line. > a form for short Python-style lambdas would really help Interesting - many in the Py
563.
▲
by
pansa2
5y ago
> isn't that how camera/vehicles control work today? And isn't it how the controls in, say, Minecraft work? One stick to rotate the character/camera and the other to move and strafe?
564.
▲
by
pansa2
5y ago
> the indentation-based syntax can make for relatively verbose code in quick ad-hoc scripts. Isn't significant indentation less verbose than Lua's use of `do ... end`?
565.
▲
by
pansa2
5y ago
> You can parallelize with threads! This is a great example of something that's more than the sum of its parts. A GIL-constrained language and a single-threaded language working together to run code in parallel - something that ne
566.
▲
by
pansa2
5y ago
>>> exit Use exit() or Ctrl-Z plus Return to exit
567.
▲
by
pansa2
5y ago
Yes - this is the reason I've switched to Go for writing command-line apps. I don't like Go as much as Python (Go is simpler, but not as easy ), but being able to compile a self-contained executable is huge. It's also great
568.
▲
C++ Committee don’t want to fix range-based for loop in C++23 (broken for 10yrs)
(twitter.com)
34 points
by
pansa2
5y ago
|
10 comments
569.
▲
by
pansa2
5y ago
https://www.python.org/dev/peps/pep-3113/#why-they-should-go
570.
▲
by
pansa2
5y ago
Functional programming isn’t how people think, and it isn’t how computers work. Therefore it’s a bad way for the two to communicate.
More ›