Python - do big doc strings waste memory?
Posted
by orokusaki
on Stack Overflow
See other posts from Stack Overflow
or by orokusaki
Published on 2010-04-29T16:13:34Z
Indexed on
2010/04/29
16:17 UTC
Read the original article
Hit count: 464
I understand that in Python a string is simply an expression and a string by itself would be garbage collected immediately upon return of control to a code's caller, but...
- Large class/method doc strings in your code: do they waste memory by building the string objects up?
- Module level doc strings: are they stored infinitely by the interpreter?
Does this even matter? My only concern came from the idea that if I'm using a large framework like Django, or multiple large open source libraries, they tend to be very well documented with potentially multiple megabytes of text. In these cases are the doc strings loaded into memory for code that's used along the way, and then kept there, or is it collected immediately like normal strings?
© Stack Overflow or respective owner