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

Great article. One question:

> There’s one final use for the splat ( * ); when overriding methods in a subclass and calling super. If it turns out you don’t need the arguments to the method for whatever additional behaviour you’re adding, you can accept all arguments with a bare splat, then a bare super passes all arguments to super.

I thought that was the default behavior of super. Isn't it the case that a bare super by default passes all the method's original arguments? I know this has bit me in the past where I've been forced to call `super()` with empty parentheses explicitly to prevent this behavior.



You're correct, that is the default behaviour of super.

My intention wasn't to say that super only works like that when you've defined the method like `def foo( * )` but rather `def foo( * )` is an alternative to having to name your arguments when you're not even going to use them as they are automatically passed with bare super.


Ah, yes, of course. I understand now. Skimmed a bit too fast there and misunderstood what you were getting at. Thanks!




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

Search: