Python memory-efficient programming