Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
mehrdadn
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
55 ms
·
511.
▲
by
mehrdadn
6y ago
He's comparing unique_ptr to just plain old-fashioned new and delete. Is it obvious to you what the actual cost is in moving between these? It's not really obvious and probably not what you think. I would listen to the full sectio
512.
▲
by
mehrdadn
6y ago
With the caveat that I am NOT suggesting this justifies choosing C over C++, I just wanted to mention this talk about how "zero-cost abstraction" is an idealism, not necessarily a reality: https://www.youtube.com/w
513.
▲
by
mehrdadn
6y ago
Changing food production is possibly one of the easiest ways to attack climate change, as far as physical/biological feasibility goes (desires of tastebuds notwithstanding). Nobody trying to tackle food production suggests you should b
514.
▲
by
mehrdadn
6y ago
I've tried D-ary heaps before (even min-max d-ary heap). Somehow my memory was that D = 3 or 4 sometimes performed better than 2, but now that I checked, in my code (which I spent a lot of times optimizing) I settled on plain binary he
515.
▲
by
mehrdadn
6y ago
I think there was another post for Indigo Agriculture as well: https://news.ycombinator.com/item?id=24342977
516.
▲
by
mehrdadn
6y ago
You might like this one: https://www.youtube.com/watch?v=nj-Iwv5NJKg
517.
▲
by
mehrdadn
6y ago
This is a fantastic page. I just have an issue with one of his points though: > That banks do not have any special powers in relation to money creation They most definitely do though: FDIC insured accounts have legal government backing—a
518.
▲
by
mehrdadn
6y ago
How/why is it such an incredibly "clean" and round hole?
519.
▲
by
mehrdadn
6y ago
Some more reading: https://en.wikipedia.org/wiki/Induced_demand > City planner Jeff Speck has called induced demand "the great intellectual black hole in city planning, the one professional certainty that every
520.
▲
by
mehrdadn
6y ago
The XML might be awful for viewing but I do wonder if it would diff better for storage? Git is awfully inefficient for storing binary data.
521.
▲
by
mehrdadn
6y ago
> Where the hell are unarmed police the norm other than the UK and NZ? Here's a sampling. I think not every country is considered in these lists though. Or at least, given there can be multiple police forces in a jurisdiction with o
522.
▲
by
mehrdadn
6y ago
Depends what he means by "modern recorded history", but yes, I'm aware of basic history, thank you very much. What I was saying was that it is not at all obvious whether they have actually experienced such fires before or not
523.
▲
by
mehrdadn
6y ago
>> The 1400-year-old Armstrong tree > The bare fact that a tree is 1400 years old is pretty strong evidence that it's unlikely to be harmed by a fire. For fires the likes of which they've experienced in their lifetimes, p
524.
▲
by
mehrdadn
6y ago
You can, but Python 2 is still the default on some systems so I thought I'd just put it and make people's lives easier.
525.
▲
by
mehrdadn
6y ago
That's an excellent question and this opens the door to another another interesting discussion. I don't have the energy for that unfortunately, but to reply to your comment: it's not really important that it succeeds per se.
526.
▲
by
mehrdadn
6y ago
I'm not suggesting it's common; it really depends what the beginner is doing. If you're just learning Python because you're trying to use e.g. a web framework like Django (that uses mixin classes all over the place), the
527.
▲
by
mehrdadn
6y ago
No I'm not saying I would rather it be implicit. That can have other adverse repercussions. My goal here was just to identify the problem precisely, because (as you can clearly tell from the thread) it is anything but obvious, even for
528.
▲
by
mehrdadn
6y ago
The answer is a qualified "yes". Because not only can it no longer participate in multiple inheritance, but it is very prone to misbehaving silently when used in such a manner, even for experienced Python users. I say qualified be
529.
▲
by
mehrdadn
6y ago
> And then you get two calls to Base: "2 calls to Base" is a misleading way to put it. You in fact get exactly 1 call per every instance of Base in the hierarchy (and they act independently). Contrast that with Python where y
530.
▲
by
mehrdadn
6y ago
> That's not at all what Python does. I know what's going on and my comment was sufficiently accurate to get the point across in 1 sentence. I wasn't exactly intending to get into a lecture on MRO here. > C++ solves the
531.
▲
by
mehrdadn
6y ago
> Isn't this a bug in class C, not your original snippet? It's not. The bug is in A.__init__. It needs to call super().__init__(). C would work fine in that case.
532.
▲
by
mehrdadn
6y ago
> What's your point about this nonstandard extension? My point was what I said: you can have your cake and eat it too. You claimed the issue was due to a lack of a super keyword and I showed you it would not occur even if C++ had su
533.
▲
by
mehrdadn
6y ago
> It's true that C++ doesn't have this problem, because it has no super keyword and you must explicitly delegate everything It's emphatically not "having a super keyword" or not having it. That's a red her
534.
▲
by
mehrdadn
6y ago
No I don't (the code is as-is), but in fact if I did, those those would still suffer from basically the same problem even if I did (exercise for the reader). In modern Python you're supposed to use super().__init__() to let it han
535.
▲
by
mehrdadn
6y ago
> The original code snippet had no bugs until you added more code, stop arguing in bad faith. Wow, that's a really low blow. I'm arguing in perfectly good faith. Failing to call the base class initializer introduces misbehavior
536.
▲
by
mehrdadn
6y ago
It's missing a super().__init__() call. This code would've worked fine had that line been there. You would not encounter this issue in e.g. C++. It's strictly due to Python's idiosyncratic linearization of the inheritanc
537.
▲
by
mehrdadn
6y ago
This should help: what should the following code output? class B(object): def __init__(self): self.y = 2 class C(A, B): pass print(C().y)
538.
▲
by
mehrdadn
6y ago
Okay, here you go. Find (& explain) the bug in this class definition: class A(object): def __init__(self): self.x = 1
539.
▲
by
mehrdadn
6y ago
I didn't mean to imply otherwise. Drama is often not malice and rather due to legitimate concerns on one or both sides.
540.
▲
by
mehrdadn
6y ago
I wish Linux on NTFS could share metadata with WSL1. That way you could boot it off the same WSL1 files you could access in Windows.
More ›