I'm fairly new to coding so I will assume some things (and only talk about Python, since it's the only language I know):
- There is somewhere a kind of package with classes "string", "tuple", "dictionary" and so on.
- Those classes have methods like... class "string" has a
def capitalize():
inside. - That package gets automatically (and forcefully) imported to any python file.
- You can read and write that file (even if it probably is a bad idea).
So, could I write extra methods to that file? I guess there's nothing really that you can't do with a function outside that file (for example, if I wanted it to change a string InTo ThIs KiNd Of TyPiNg, I can add a method or just write a function in a file called tools.py and import it anywhere) but I'm curious about whether or not it's possible to do that, and the pros and cons of doing it.
Off the top of my head, some cons are:
- You could completely screw Python and have to reinstall
- Some code might work on your pc but might need some (slight) tweaking for it to work for other people
But maybe it's faster? Hahaha really no idea :)