Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why can't you just call the method on the instance directly? This is only useful for when a, is not quite the same type as the the class you're copying the method from.


Do you mean why not have the method be global in the first place? That's fine for simple pipelines, not ones that need to be flexible and have some kind of reusable interface. And I personally find it a bit annoying if you have to switch between class methods and global ones jumping in and out of the class to understand what's happening.


if the method is called "f" and it exists on "a" then you have access to "f" via "a.f()". It's redundant to call it via "f(a)".

If you're saying it's easier to edit "f" in the repl/notebook vs. on the class where it's defined, well that's a sort of a convenience factor, I wouldn't exactly call it a huge benefit overall as this is mostly a very specific use case.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: