Read my book

I wrote books about Webpack and React. Check them out!

Sunday, January 31, 2010

Python - "in" gotcha

I'm currently working on the next release of Pynu. It will have some nice goodies I need for the file system project and better documentation. During development I happened to come upon an interesting "gotcha" in Python:



I would expect it to be False as I assumed it operates based on the identity of the object always. It will return True, however! So if you want to check does a list contain an empty list, use some other way (iterate items and check using "is" for instance).