Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pansa2
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
66 ms
·
811.
▲
by
pansa2
6y ago
But Python still has a reputation of being a simple language for beginners. I’m not sure how that reputation endures. Is it just because of the lightweight syntax?
812.
▲
by
pansa2
6y ago
I’m not interested in using type annotations in Python. But, whenever I express my wish that they hadn’t been added to the language, the reply is always “they’re optional, you don’t have to use them”. Thank you for yet another example of wh
813.
▲
by
pansa2
6y ago
Another example of the support for type hints turning code which should be invalid into valid code with unexpected behaviour: https://mobile.twitter.com/reuvenmlerner/status/129031712499...
814.
▲
by
pansa2
6y ago
What’s the status of Structural Pattern Matching? Is it likely to make it into 3.10?
815.
▲
by
pansa2
6y ago
So many different ways to install Python - doesn’t anybody just use the official installer from python.org/downloads?
816.
▲
by
pansa2
6y ago
> the "toGNUCommandLine" function would specify that it takes in a list of strings The problem is that `List<String>` isn't the correct type for that function's parameter. It converts each item in the list to
817.
▲
by
pansa2
6y ago
I like the Nix example - accidentally constructing a `List<String|Function>` and passing it into a function expecting a `List<String|...>` (where `...` does not include Function). The dynamically-typed version can't do anyt
818.
▲
by
pansa2
6y ago
How would PyO3 help you avoid type hints and mypy?
819.
▲
by
pansa2
6y ago
Related: RustPython - A Python interpreter written in Rust. https://github.com/RustPython/RustPython
820.
▲
by
pansa2
6y ago
Why not? `nonlocal` is pretty straightforward, isn’t it?
821.
▲
by
pansa2
6y ago
I just don't think the decorator should be required for static methods. If you write `def foo(a, b)` inside a class, the lack of `self` should be sufficient to make `foo` a static method. IMO it would make sense for Python to look at
822.
▲
by
pansa2
6y ago
Python's actual behavior in this case is far stranger than static methods, which are a standard feature of many object-oriented languages (albeit one that's fairly redundant in a language that allows free functions).
823.
▲
by
pansa2
6y ago
> Are there psychotic devs out there who call it something other than `self`? Yuck! Sometimes I like to overload operators using `def __add__(lhs, rhs)` and `def __radd__(rhs, lhs)`.
824.
▲
by
pansa2
6y ago
We can inherit from `list`, `dict` etc., but objects of those classes are still not as flexible as "normal" objects. For example, we can't add an attribute to a list using `l = []; l.a = 1`.
825.
▲
by
pansa2
6y ago
> tying methods with the individual/first argument makes it very difficult to model interactions of multiple objects. The best example of this in Python is operator overloading. We need to define both `__add__` and `__radd__` meth
826.
▲
by
pansa2
6y ago
> What are emphatically not pretty or useful are Python’s leading underscores to loosely enforce encapsulation. IMO Go's use of upper/lower case is even worse than Python's use of underscores. What would be better? Expli
827.
▲
by
pansa2
6y ago
> I've moved to Guile as my small scripting language. I have been using Lua as an alternative to Python. It's much closer to my ideal level of language complexity - and I think overall it's better designed than Python, a
828.
▲
by
pansa2
6y ago
> Python is adding so many features that it's becoming something "not python" Here's an example I came across recently. It's from the official documentation for the `heapq` module, so I assume it's now con
829.
▲
by
pansa2
6y ago
How so?
830.
▲
by
pansa2
6y ago
In my experience, reading code.
831.
▲
by
pansa2
6y ago
Agreed (type hints are just one example), but I wish it were.
832.
▲
by
pansa2
6y ago
Maybe it’s “growing up”, but I agree that Python has definitely changed its focus. It has pivoted towards the handful of companies with “projects with tens and hundreds of developers“ at the expense of the millions(?) of people using it for
833.
▲
by
pansa2
6y ago
A language that tries to satisfy both of these groups won’t be ideal for either of them. Python should aim to be perfect for group 1. There are many other languages that will always be a better choice for group 2.
834.
▲
by
pansa2
6y ago
Python’s philosophy is supposed to be “one obvious way to do it”, not “you decide which way to do it, it’s optional”.
835.
▲
by
pansa2
6y ago
> Statically typed languages create a lot of complexity from being entirely dependent on types being correct in a static sense rather than at runtime. Python’s type annotations aren’t checked at runtime, though - they’re also entirely
836.
▲
by
pansa2
6y ago
Presumably the parent is comparing Python to C. There’s no way anyone is more productive in C than in Python.
837.
▲
by
pansa2
6y ago
Because someone suggested it, and Python’s main design principle nowadays is “include as many language features as possible”.
838.
▲
by
pansa2
6y ago
> Then they don't care about applications being terminated in case of std::bad_alloc and similar. No, they don't: https://youtu.be/NOCElcMcFik?t=2304
839.
▲
by
pansa2
6y ago
> which parts of libstdc++ can you safely use without exceptions? Almost all of it, as long as you're happy to abort on memory allocation failure - which, according to the article, libvirt is now willing to do. In fact for me, tha
840.
▲
by
pansa2
6y ago
It always amazes me the lengths people will go to to avoid learning & using a different language. Perhaps if you want statically-typed functional programming, you shouldn’t be using Python? It’s not the best choice for that - in fact, i
More ›