[Tkinter-discuss] Moving object on page leaves afterimage on Python 3 but not on 2

Reinis Danne rei4dan at gmail.com
Fri Feb 5 12:22:18 EST 2016


On Fri, Feb 05, 2016 at 05:03:50PM +0100, Michael Lange wrote:
> 
> Personally I hardly ever use map(), so I never noticed that. In fact this
> change is actually documented, see
> https://docs.python.org/3.0/whatsnew/3.0.html#views-and-iterators-instead-of-lists :
> 
> "map() and filter() return iterators. If you really need a list, a quick
> fix is e.g. list(map(...)), but a better fix is often to use a list
> comprehension (especially when the original code uses lambda), or
> rewriting the code so it doesn’t need a list at all. Particularly tricky
> is map() invoked for the side effects of the function; the correct
> transformation is to use a regular for loop "
> 
> Not sure what's the use of these map objects, in Python3 now you can call
> the map object's __next__() method to iterate.
> But for your purpose certainly the for loop is the way to go.
> 
> Best regards
> 
> Michael

Thanks, that clears it up. Somehow I had missed this.


Reinis


More information about the Tkinter-discuss mailing list