on information hiding


- any rule you can imagine, modules probably don't follow
- including a module doesn't even promise that the module isn't still running when it returns
- modules don't go away when you delete them, not even when every calling script also goes away. side effects can build up

- Ah.
- wait what
- I could understand why they won't vanish when the module is deleted as any active scripts would hold a reference to the contents of the now-deleted module, but if all of those scripts are inactive / deleted, then why isn't the module collected?

- because it just doesn't

- But that's stupid
- isn't that a memory leak?

- depends on what's your opinion of what a memory leak is
- the module is still running code, after all, even if it can't be controlled anymore

 - Sooo, it's inaccessible code that still consumes ram.

- it might decide to wake up one day and do something slightly useful
- and in python, code isn't data

- But, wait, doesn't that mean you could write your entire program in modules, then include those, delete the modules and the scripts requiring them, and the program would still run with no scripts anywhere?

- yes

 ...

 that is fucking spooky

 i don't like that

- about as spooky as an open python interactive session

 the code that defined those objects you were playing with no longer exists in any meaningful sense, but the objects are still there

 with no way to know where they came from or what they are

 and when you close the session, they'll just be... gone. forever.


Comments

Popular Posts