Python Gotcha's?
John Gordon
gordon at panix.com
Thu Apr 5 12:12:16 EDT 2012
In <7367295.815.1333578860181.JavaMail.geo-discussion-forums at ynpp8> Miki Tebeka <miki.tebeka at gmail.com> writes:
> Greetings,
> I'm going to give a "Python Gotcha's" talk at work.
> If you have an interesting/common "Gotcha" (warts/dark corners ...)
> please share.
This is fairly pedestrian as gotchas go, but it has bitten me:
If you are working with data that is representable as either an integer
or a string, choose one and stick to it. Treating it as both/either will
eventually lead to grief.
Or, in other words: 1 != '1'
--
John Gordon A is for Amy, who fell down the stairs
gordon at panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
More information about the Python-list
mailing list