> This is very, very deliberately a design goal of Python. I suspect we're likely not talking about this same "this." Or if we are, I'd love to hear a justification -- any justification -- against what I'm talking about, because to date, I've never run into one. Many have tried, too. :)
I'm talking about adding new functionality. NOT modifying existing functions. NOT replacing existing functions. NOT modifying existing, standard class internal variables or states. So If I add TestDottedQuad() to str, and once there it can't be replaced in the running instance, and you were to, unknowingly, end up using my extended string class, tell me where the harm is. No existing str functionality is modified. Anything you ever used will continue to work just as you expect, because it has not been modified in any way. If you don't know that TestDottedQuad() is there, it's essentially non-existent for you. If you do, and you use it... well, that's what it's there for, isn't it? In any case, I wanted that ability because I was doing a lot of interesting things to strings, and str was doing a stellar job of making that more difficult. I made it work WITHOUT monkey patching in any way, and also in a completely invisible fashion to anyone who has to parse my actual .py files, so I'm good. Preprocessors are very useful for such things. I get the extended syntax; everyone else gets standard (much more clumsy) python. > Most large Ruby projects have adopted code standards to explicitly prohibit the behavior you want, because the dangers greatly outweigh the benefits... Again, explain a danger to a nominal class user that arises due to adding NEW, immutable in the current instance, functions/functionality to a class that do not alter the existing base functionality. ANY danger. I'm very interested. In the context of Python, please. If you start talking Ruby, I'm unable to parse. --Ben
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/BFOZPKE4X3ODYQR5MB4TVQQ3GEEOQYM7/ Code of Conduct: http://python.org/psf/codeofconduct/