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

"And why would an integer have a method for converting itself to a string? Or an array?"

You know that under the covers in Python str(1) works by calling (1).__str__(), right? That's why you can make str(my_custom_class) work.



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

Search: