memory overhead using from-import?

William Trenker wtrenker at
Sun Dec 21 11:28:48 CET 2003

I'm working with an html templating application and need to escape the special characters <&>.  The cgi library module has an escape function that does this but I don't need any of the other functionality of the cgi module.

Could someone please confirm that if I code the following line in my own module:
from cgi import escape
that the only additional memory overhead from the cgi module will be that required to store the escape function's code.

I was thinking of coding an escape function, but that seems silly if importing cgi.escape would consume about the same memory.

Thanks very much,

More information about the Python-list mailing list