Re:I don't like Python. Does that make me a bad person?
by japherwocky on Saturday June 26, 2010 @09:21PM
(#1464660)
protip: the next time you need to quickly find the type of a variable, insert a trace like:
import pdb;pdb.set_trace()
then run the program, and you'll get an interactive prompt and you can just look at everything in that state.
dir( myBuggyVariable)
Tests are effectively the answer, but they are a pain to write and having to document your type information via tests seems a lot more cumbersome from just doing "int my_var".
The party line with Python and dynamic typing is true in many cases, especially when starting a new project. As time goes on though, things get confusing and tests are rarely good enough to offer the same contract static typing offers. To say "you're doing it wrong" is somewhat correct, but no one does it right all the time.