Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pansa2
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
82 ms
·
721.
▲
by
pansa2
6y ago
> Go is not an easy programming language. It is simple in many ways This, exactly. It’s worth contrasting this with Python, which has a reputation for being simple but is actually extremely complex - but it is easy (at least for smal
722.
▲
by
pansa2
6y ago
It’s crazy that the function you call to remove an element from a list is `append`.
723.
▲
by
pansa2
6y ago
> overloading of the `|` operator There’s a short discussion of this here: https://github.com/gvanrossum/patma/issues/146
724.
▲
by
pansa2
6y ago
So TypeScript is a separate language from JavaScript, but Mypy is just an extension to Python. Isn’t that merely a difference in marketing?
725.
▲
by
pansa2
6y ago
> Where are Python, Bash, etc.? [...] While there exist extensions to some dynamic languages imbuing them with static type checking these are not part of the language, and the complexity depends not on the language but the extension. B
726.
▲
by
pansa2
6y ago
runtime.LockOSThread? https://golang.org/pkg/runtime/#LockOSThread
727.
▲
by
pansa2
6y ago
> Can you do either of those in other popular languages with pattern matching? Ruby supports matching against a local variable by pinning the variable (using a ^ prefix).
728.
▲
by
pansa2
6y ago
> I have wrapped a large C++ library for Go How well does it work the other way round - calling Go from C/C++? IIRC when I first looked into doing that, it wasn’t really possible - only threads that were started by Go could run Go
729.
▲
by
pansa2
6y ago
I’ve considered Go for writing command-line apps - mostly for conversion between domain-specific formats and standard ones (e.g. proprietary image format => png). I think when considered in isolation, Go would be perfect for this. Howeve
730.
▲
by
pansa2
6y ago
Is anyone using Go’s support for compiling to WebAssembly? I know it was added experimentally a few versions ago - is it still being worked on? Is it production-ready? There’s no mention of it in these release notes.
731.
▲
by
pansa2
6y ago
> I dont consider prototypes-based OO a real OO. Fair enough - in some ways it’s like half-way to an OO system. Yes, it’s theoretically elegant to have everything be an object and not to have classes. However in the vast majority of ca
732.
▲
by
pansa2
6y ago
> `a = a + b` and `a += b` are completely different operations Getting off-topic, but IMO that’s a major design flaw in the language. Some others agree, e.g. https://twitter.com/joepolitz/status/13049926962939
733.
▲
by
pansa2
6y ago
> You can choose not to use it. I hear this a lot about features in Python. Type hints, dataclasses, walruses, and now pattern matching. Whenever someone complains about language bloat, the reply is “it’s optional”. But that’s only tru
734.
▲
by
pansa2
6y ago
The problem is that `NOT_FOUND` behaves differently from the literal `404`, which breaks an important principle: “if you see an undocumented constant, you can always name it without changing the code’s meaning” [0]. [0] https://t
735.
▲
by
pansa2
6y ago
Renaming the variable doesn’t fix the code. It still prints “HTTP Not Found” for every value of `status_code`.
736.
▲
by
pansa2
6y ago
> You can combine several literals in a single pattern using | ("or"): `case 401|403|404:` So how do I do a bitwise-or operation within a pattern? I think given issues like this and the commonly-cited NOT_FOUND example [0], i
737.
▲
by
pansa2
6y ago
> JS or even Python (both were not OO in first version) This isn't true for Python. Quoting Guido: "classes were added late during Python’s first year of development at CWI, though well before the first public release" [
738.
▲
by
pansa2
6y ago
I'm still amazed at how Python code with type hints looks so different to Python without them. Consider the program near the end of the article - if we remove the type hints: - The `AstNode` abstract base class becomes completely unnec
739.
▲
by
pansa2
6y ago
Makes sense. The optimisation only applies when the reference count is one, and PyPy doesn’t use reference counting.
740.
▲
by
pansa2
6y ago
> it seems that Ruby is determined to keep adding syntax. With async/await, type hints, the walrus operator and now pattern matching, Python’s designers are just as guilty of this as Ruby’s.
741.
▲
by
pansa2
6y ago
Yes, Python has an integer cache holding the values -5 to 256.
742.
▲
by
pansa2
6y ago
Taking advantage of a reference count of 1, like this, must be one of very few places where reference counting can provide a performance improvement over tracing garbage collection.
743.
▲
by
pansa2
6y ago
Does Python deliberately allocate extra space at the end of each string to enable characters to be appended in-place (similar to lists)? Or does it just use space that’s available as a side-effect of memory allocation, e.g. by calling `real
744.
▲
Typing Is Hard
(3fx.ch)
190 points
by
pansa2
6y ago
|
130 comments
745.
▲
by
pansa2
6y ago
Ruby’s syntax is definitely more complex than Python’s (which until recently was LL(1)), but it wouldn’t surprise me if Ruby as a whole was a simpler language. For example, Ruby’s object model is much simpler and more elegant than Python’s.
746.
▲
by
pansa2
6y ago
I’m not sure what you mean. How is “two people working full-time“ not equivalent to “two full-time employees”?
747.
▲
by
pansa2
6y ago
How are they planning to “ensure volunteer hours are used effectively” if they can’t direct those volunteers?
748.
▲
by
pansa2
6y ago
> to ensure future funding and volunteer hours are used efficiently and effectively. One of the reasons that Python’s development has been so haphazard in the past few years is because the language is primarily developed by volunteers,
749.
▲
by
pansa2
6y ago
> GvR had plenty of freedom to work on his Python projects while at Dropbox. That post was made while Guido was at Dropbox, and it claims he had one day a week?
750.
▲
by
pansa2
6y ago
Don’t know why this is downvoted. AFAIK most core developers spend, at most, 20% of their paid time on the language / 80% on other things, not (as you might think) 80% / 20%.
More ›