문제

I build very big dictionary (2^20 elements) in python using dictionary generator expression (i'm using IDLE for this). The process is very long because of every element needs hard computing. It is possible to get known progress of this operation?

I understand that it is easy to do if don't use generator expressions, but nevertheless this question is interesting I think.

도움이 되었습니까?

해결책

If you use yield to write a generator function instead of just using a generator statement, you could put logging or some other sort of feedback before every yield statement.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top