Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
duckerude
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
11 ms
·
91.
▲
by
duckerude
6y ago
Control+Y is already taken, and Control+Shift+Z is indistinguishable from Control+Z because of terminal limitations. So I can't think of anything better.
92.
▲
by
duckerude
6y ago
Not having to fight against POSIX. Arrays are first-class, strings don't split when you don't want them to, things that could be builtins generally are builtins instead of inscrutable syntax. Command output is split on newlines, w
93.
▲
Putting regexes where they don't belong
(bean.solutions)
2 points
by
duckerude
6y ago
|
0 comments
94.
▲
by
duckerude
6y ago
Reminds me of this XML-related vulnerability: https://siguza.github.io/psychicpaper/ I hadn't realized JSON was this susceptible to the same kind of issues.
95.
▲
by
duckerude
6y ago
If you're working with files, another (perhaps more reliable) way is `rm ./-rf`.
96.
▲
by
duckerude
6y ago
It's not that powerful, if I'm reading it correctly: https://github.com/python/cpython/commit/34df10a9a16b38d5442... The sprintf is to a temporary buffer that's converted to a PyUnicode object
97.
▲
by
duckerude
6y ago
That's not great if you still want to use the underlying value, because then you need to unwrap it later.
98.
▲
by
duckerude
6y ago
With a quick grep I find this: - `uuid` used ctypes until 3.9 to get information like the IP address (without floats, so it's not vulnerable) - `platform` uses ctypes in 2.7 to get the Windows version (without floats) - `multiprocessin
99.
▲
by
duckerude
6y ago
Minimal example: >>> import ctypes >>> x = ctypes.c_double.from_param(1e300) >>> repr(x) Segmentation fault This happens when getting the string representation of a foreign function float. It doesn&#x
100.
▲
by
duckerude
6y ago
> The recent track record of curl shows it has zero reported memory safety issues recently. Only if you look very recently. Earlier you said: > You have to go back 9 months before you find one expired-pointer derefence issue resulting
101.
▲
by
duckerude
6y ago
Rust does not solve the memory safety issue. It does mitigate it, and the post is about mitigation. That study finds that Rust "successfully limits memory-safety risks to the realm of unsafe code". It also finds that Rust has nove
102.
▲
by
duckerude
6y ago
The main problem is probably heterogenous collections. If you have a collection with both ints and strings then hashing will work fine but comparing will fail (in Python 3). (Frozensets are hashable but not sortable but that's probably
103.
▲
by
duckerude
6y ago
Unicode is not quite the right place for the line, I think. Cypro-Minoan is text (but not currently part of unicode). ASCII art is not text. Linearity is part of it. Source code and emoji and simple math expressions can be seen as a linear
104.
▲
by
duckerude
6y ago
I don't think it counts for the purposes of this blog post. You can't translate the Wikipedia quote in the article into an SVG except by just rendering the bare text. Checking programmatically that text is about "bird" o
105.
▲
by
duckerude
6y ago
> domain.endsWith("hulu.com") Huh, does that mean it would also apply on "thisisnothulu.com"? Most other endsWith calls seem to do e.g. `domain.endsWith(".hulu.com")` to only match subdomains.
106.
▲
by
duckerude
6y ago
Couldn't the old object only ever get deallocated after the new one is allocated?
107.
▲
Python's Early Language Design and Development (2009)
(python-history.blogspot.com)
3 points
by
duckerude
6y ago
|
0 comments
108.
▲
by
duckerude
6y ago
> in fact, I would have gone a step further and made integer division return fractions rather than floats by default, as well This was decided against in Python: > ABC had two types of numbers at run time; exact numbers which were rep
109.
▲
by
duckerude
6y ago
It is. The question was how often that's the case. If 50% of the uses of random() are bad, then getting those fixed may be worth the cost of annoying the authors of the legitimate 50%. It turned out to be much less useful than that. So
110.
▲
by
duckerude
6y ago
Based on https://internals.rust-lang.org/t/can-the-standard-library-s... it looks like that's probably the case, but that it's not beyond all doubt that it holds across all Unix-likes. > On Linux, the answ
111.
▲
by
duckerude
6y ago
JavaScript messed it up, but Python did it well. A newline is a statement separator, unless it's e.g. between parentheses where a statement separator wouldn't make sense. Unlike JavaScript, that means you don't have to look a
112.
▲
by
duckerude
6y ago
I found one: https://raw.githubusercontent.com/helloSystem/hello/master/s...
113.
▲
by
duckerude
6y ago
Map, filter and lambda were originally suggested by a Lisp programmer, so those do show functional Lisp heritage. (I don't know of similar cases.) But they're a small part of the language. Comprehensions are now emphasized more, a
114.
▲
by
duckerude
6y ago
How many of these features are present in neither statically typed functional languages nor dynamically typed procedural languages? My impression is that Python has a) a lot of bog-standard dynamic features, and b) a few functional features
115.
▲
by
duckerude
6y ago
Has it absorbed features from functional Lisp dialects, or does it just have features in common? Early Python was inspired by ABC and C. ABC has a Python-like REPL, strong dynamic typing, automatic memory management, memory safety, a nice c
116.
▲
by
duckerude
6y ago
Rust seems to handle it ok. Features can spend a long time being nightly-only gated behind feature flags, while nevertheless seeing real world usage from people willing to brave the risk and churn. But Python has a very different release sc
117.
▲
by
duckerude
6y ago
You can write it for ints, figure out it's also useful for strings, and change the signature to also accept str. And then if you do ever want to change the implementation you can reason about the callers more easily and you won't
118.
▲
by
duckerude
6y ago
The GIL doesn't really let you escape the horrors of concurrency, at least in CPython. Threads can't execute at the same time, but they can interleave in inconvenient ways.
119.
▲
by
duckerude
6y ago
`addable` might be too broad. It describes the implementation, but not the intent. If you know that x is only ever an int then you can safely change the implementation to `return 2 * x`. Sometimes constraints give you extra possibilities.
120.
▲
by
duckerude
6y ago
All the examples are things that no longer work in Python 3. Half of them are about functions like range() and .values() becoming lazy instead of returning simple lists. I think this is a genuine blow to ease of use, though it does get rid
More ›