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

"Feeding an unexpected type into a function, and having it carry on as normal, is really scary."

That is how duck typing works. Generally you shouldn't use "is instance" but more use a set of "callable" checks to make sure the structure has the required functions.

Things like Go Interface types are, of course, a formalisation of duck typing and is what has helped static typing come back into fashion.



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

Search: