Re:WTFPython – Understanding Python through surprising snippets
by varelaz on Monday December 23, 2019 @04:00AM
(#21862332)
There is nothing bad in general with list comprehension there. Problem is lambda which uses variable from outer scope. In Python, comparing to JS, using variables from outer scope is not so common. I prefer more obvious constructions and in case of problems with scope I can even create class to protect value that I need to manage.
[ Parent
| on HN ]
There are no comments on this comment yet.