• 0 Posts
  • 50 Comments
Joined 2 years ago
cake
Cake day: June 12th, 2023

help-circle
  • The interpreter can’t make the replacement until it’s about to execute the line as __bool__ and __len__ are both (Python’s equivalent of) virtual functions, so it’s got to know the runtime type to know if the substitution is valid. Once it’s that late, it’ll often be faster to execute the requested function than work out if it could execute something faster instead. Even with type hints, it’s possible that a subclass with overridden methods could be passed in, so it’s not safe to do anything until the real runtime type is known.

    Once there’s a JIT involved, there’s an opportunity to detect the common types passed to a function and call specialised implementations, but I don’t think Python’s JIT is clever enough for this. LuaJIT definitely does this kind of optimisation, though.






  • The feedback in the article was obviously far from perfect, but from the sound of it, “good attempt” could be an actively harmful thing to say. Lots of effort had gone into making the wrong thing and making it fragile, which isn’t good at all, it’s bad. If you’d asked an employee to make a waterproof diving watch, and they came back with a mechanical clock made from sugar, even though it’s impressive that they managed to make a clock from sugar, it’s completely inappropriate as it’d stop working the instant it got wet. You wouldn’t want to encourage that kind of thing happening again by calling it good, and it’s incompatible enough with the brief that acknowledging it as an attempt to fit the brief is giving too much credit - someone who can do that kind of sugar work must know it’s sensitive to moisture.

    The manager can apologise for not checking in sooner before so much time had been spent on something unsuitable and for failing to communicate the priorities properly, and acknowledge the effort and potential merit in another situation without implying it was good to sink time into something unfit for purpose without double checking something complicated was genuinely necessary.


  • Arch is at least more likely to update to a fixed version sooner, and someone getting something with pacman is going to be used to the idea of it breaking because of using bleeding edge dependencies. The difference with the Flatpak is that most users believe that they’re getting something straight from the developers, so they’re not going to report problems to the right people if Fedora puts a different source of Flatpaks in the lists and overrides working packages with ones so broken as to be useless.




  • There are already slats so the only hole you can get a fork into is the earth, unless you’ve already got something convincingly shaped like an earth pin in the earth hole to open the slats over the live and neutral. If you’re going to that much effort to zap yourself, the switch isn’t going to be much of a hurdle.

    I’d suspect that it’s largely because it’s more convenient to have a switch than to unplug things and plug them back in again, especially as our plugs are a nightmare to step on to the point that Americans complaining about stepping on lego seems comical to anyone who’s stepped on lego and a plug.




  • Putting "false" in a YAML file gives you a string, and just false on its own gives you a boolean, unless you tell the YAML library that it’s a string. Part of the point of YAML is that you don’t have to specify lots of stuff that’s redundant except when it would otherwise be ambiguous, and people misinterpret that as never having to specify anything ever.


  • Most of the problems can be totally avoided by telling the YAML loader what type you’re expecting instead of forcing it to guess (e.g. provide a schema or use typed getter functions). If it has to guess, it’s no surprise that some things don’t survive the string to inferred type to desired type journey, and this is something that isn’t seen as a dealbreaker in other contexts, e.g. the multitude of languages where the string "false" evaluates to true when converted to a boolean because it’s non-empty.


  • Something I’ve not seen mentioned here yet is that one of the reasons it’s such an effective way to make money is specifically because loads of people are buying into it. When you buy a stock (or a derivative like an S&P 500 index tracking fund), it increases its price. If you’re just one person with a normal-person amount of money, it won’t be enough to register, but if you’re part of a group of millions of people, or an investor with billions at your disposal, it’ll make a visible difference, and if people see that happening consistently, they’ll want to join in and there’ll be a positive feedback loop. It only stops when there’s a big enough panic that lots of investors can no longer afford to maintain their investment and have to sell at the same time, and then you can even get a positive feedback loop in the other direction when people see the price plummeting and decide they need to sell before it plummets any further.

    Stocks are supposed to represent the value of a company’s current assets and expected future profits, but this kind of feedback loop muddies the water. With something like Bitcoin, which intentionally has no inherent value, because enough people have agreed to pretend otherwise, it’s gained effective value, and can be exchanged for money, or in some cases, goods and services. That’ll remain the case until everyone agrees that they don’t want Bitcoin, so could go on forever.





  • This is silly. Everyone knows that DRY is telling you that if you do the same sequence of mouse clicks three times in a row, you should spend the day writing a script to automate the task instead of quickly finishing what you were doing by doing the same sequence of clicks a fourth time. If you are supposed to apply it to the code you write, then there’d never be boilerplate-heavy languages like Java.