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

Can it be done for built-in types?


No, it can't, at least not in CPython. You can import __builtin__ and clobber str, for instance, but that will not affect the behavior of existing strings, nor will it influence the behavior of string literals.

It's something that can be done in Ruby and JavaScript, but I believe it was never allowed in Python in the name of performance (you incur overhead when every number is Fixnum with the same lookup rules as any other instance, for example), and also safety.


No, unfortunately. That's one thing both Ruby and JS have over Python.


Some Python programmers might argue that's one thing Python has over Ruby and JS.


Yup (see my response)




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

Search: