On 19 September 2013 15:38, Peter Otten <__pete...@web.de> wrote: >> While running the above python.exe was using 6MB of memory (according >> to Task Manager). I believe this is because tee() works as follows >> (which I made up but it's how I imagine it). > > [...] > >> However, when I ran the above script on Python 2.7 it did consume >> massive amounts of memory (1.6GB) and ran slower so maybe this depends >> on optimisations that were introduced in 3.x. > > Did you use xrange()?
No I didn't. :) Okay so it only uses 4.6MB of memory and it runs at the same speed: there's no problem with chaining tee objects as long as you discard them. If you don't discard them then a script like the one I wrote would quickly blow all the system memory. Oscar -- https://mail.python.org/mailman/listinfo/python-list