Hacker News new | past | comments | ask | show | jobs | submit login

I think anybody that ever did LeetCode/HackerRank in Python had that bug at least once when making an empty 2-D DP table or a return matrix.

My bigger question is how does a professor of machine learning does not know about one of the oldest Python footguns to exist:

https://stackoverflow.com/questions/12791501/why-does-this-c...

Very nice article otherwise, I never actually bothered looking into why it behaved this way(at this point most people initialize using list comprehension, so this bug is IMO very rare in production), very well explained.




> My bigger question is how does a professor of machine learning does not know about one of the oldest Python footguns to exist

Because there's a lot of them. And as soon as you touch a sane language that fits your intuitive model of how things should work, going back to Python means that you'll start doing intuitive things that Python will happily and silently transform into unintuitive operations.


Yep, common enough that everyone learns it.

I started using loops and it motivated me to start writing list comprehensions. One of the foot guns that will really motivate you to understand Python as a tool more than anything.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: