Readit News logoReadit News
cauthon commented on Crimes with Python's Pattern Matching (2022)   hillelwayne.com/post/pyth... · Posted by u/agluszak
dragonwriter · 7 months ago
> It essentially allows the user to check if a class implements an interface, without explicitly inheriting ABC or Protocol.

Protocols don't need to be explicit superclasses for compile time checks, or for runtime checks if they opt-in with @runtime_checkable, but Protocols are also much newer than __subclass_hook__.

cauthon · 7 months ago
TIL, thanks!

(I love being wrong on HN, always learn something)

cauthon commented on Crimes with Python's Pattern Matching (2022)   hillelwayne.com/post/pyth... · Posted by u/agluszak
xg15 · 7 months ago
Maybe I have too much of a "strongly typed language" view here, but I understood the utility of isinstance() as verifying that an object is, well, an instance of that class - so that subsequent code can safely interact with that object, call class-specific methods, rely on class-specific invariants, etc.

This also makes life directly easier for me as a programmer, because I know in what code files I have to look to understand the behavior of that object.

Even linters use it to that purpose, e.g. resolving call sites by looking at the last isinstance() statement to determine the type.

__subclasshook__ puts this at risk by letting a class lie about its instances.

As an example, consider this class:

  class Everything(ABC):

    @classmethod
    def __subclasshook__(cls, C):
      return True

    def foo(self):
      ...
You can now write code like this:

  if isinstance(x, Everything):
    x.foo()
A linter would pass this code without warnings, because it assumes that the if block is only entered if x is in fact an instance of Everything and therefore has the foo() method.

But what really happens is that the block is entered for any kind of object, and objects that don't happen to have a foo() method will throw an exception.

cauthon · 7 months ago
You _can_ write pathological code like the Everything example, but I can see this feature being helpful if used responsibly.

It essentially allows the user to check if a class implements an interface, without explicitly inheriting ABC or Protocol. It’s up to the user to ensure the body of the case doesn’t reference any methods or attributes not guaranteed by the subclass hook, but that’s not necessarily bad, just less safe.

All things have a place and time.

cauthon commented on Amazon to invest another $4B in Anthropic   cnbc.com/2024/11/22/amazo... · Posted by u/swyx
yoyohello13 · a year ago
Claude is absolutely incredible. And I don’t trust openAI or Microsoft so it’s nice to have an alternative.
cauthon · a year ago
Amazon famously more trustworthy
cauthon commented on Scientific Visualization: Python + Matplotlib (2021)   github.com/rougier/scient... · Posted by u/danso
weinzierl · a year ago
My weapon of choice is still R + dyplr + ggplot2 - mostly because I have been using it for so long and know it by heart.

I'd love to try something new, but don't feel the whole Python world is it. Is there any modern take - doesn't have to be production ready but should show a promising future? Anything from a more modern ecosystem, like Rust or zig, maybe?

cauthon · a year ago
Why on earth would you want to do exploratory data analysis in a compiled language
cauthon commented on Microsoft lays off 1,900 Activision Blizzard and Xbox employees   theverge.com/2024/1/25/24... · Posted by u/mikece
thinkingtoilet · 2 years ago
If you love Starcraft just a quick reminder that the Korean Brood War scene is still going strong, and is now getting bigger. BW is a near perfect game and it's clear with how they handled SC2 "Blizzard" is not going to make anything close to BW ever again. I would highly recommend checking it out if you love Starcraft. For starters, Artosis casts a pro-level ladder game every day on this channel:

https://www.youtube.com/@ArtosisCasts/videos

If you like that, the main BW tournament is called ASL and happens a couple times a year. The next one should be starting relatively soon.

cauthon · 2 years ago
I’d love a brood war remaster
cauthon commented on Zed, a collaborative code editor, is now open source   zed.dev/blog/zed-is-now-o... · Posted by u/FeroTheFox
misternugget · 2 years ago
I only joined Zed, the company, a week ago, so take this with a grain of salt, but:

I've never really used real-time sharing (tried VS Code's Live mode and other apps) for longer than just 1-2 attempts, but at Zed things are different somehow. Everybody is constantly available in a channel and people just hop in or out. In the last 7 days I spent 3-5hrs every day pairing with others, using Zed's live mode. No video, only audio and sharing code in Zed (no video was weird at first, but now I think I'm starting to get used to it?)

IMHO it's a combination of culture and technology, but when the mix of that is right it really feels game-changing.

cauthon · 2 years ago
> In the last 7 days I spent 3-5hrs every day pairing with others

This sounds remarkably inefficient?

Deleted Comment

cauthon commented on Zoom Fatigue Is Real, According to Brain Scans   spectrum.ieee.org/zoom-fa... · Posted by u/pseudolus
dtjb · 2 years ago
I like that Teams added the option to hide your self-view. Even if you don't focus on it, just having a slightly delayed mirror copy of yourself in the corner of the screen is mildly distracting. It feels more natural talking to a group of people that doesn't include yourself.
cauthon · 2 years ago
Zoom also has this option
cauthon commented on What Is the Future of the DAW?   djmag.com/features/what-f... · Posted by u/sowbug
taywrobel · 2 years ago
If anyone else is as frustrated as I was with the article mentioning “the DAW” 73 times without defining once what the actual acronym stands for, it’s “Digital Audio Workstation”.
cauthon · 2 years ago
In the same way I don’t expect a biologist writing for biologists to explain “DNA” stands for “deoxyribonucleic acid”, it’s probably not necessary for a music producer writing for producers and engineers to define “DAW”.

Users here probably feel the same way about HTML, FIFO, DAG, etc

cauthon commented on macOS Sonoma is available today   apple.com/newsroom/2023/0... · Posted by u/mfiguiere
climb_stealth · 2 years ago
Oh oh, it's getting closer. Currently on MacOS 12 with my trusted 2015 Macbook Pro. It still goes strong, but looks like the next major release may see the end of homebrew for this one. There's really no issue with this computer other than 16gb of RAM being a bit tight when every modern app is using Electron. Oh well, see how we go.
cauthon · 2 years ago
Fedora mostly works out of the box on my 2015 MBP

u/cauthon

KarmaCake day1119February 13, 2015View Original