Hacker News new | ask | show | jobs
by nknighthb 4725 days ago
The biggest tip: The Python interactive shell is your friend. Use it to play with things you're not sure of. IPython[1] is a more advanced Python shell you may like. Lots of people also swear by pdb, the Python debugger. Personally, I get less use out of it than others, but YMMV.

But overall, this is a problem involving documentation, design and naming, and your own mindset.

Ideally you would never really be put in the position of not knowing, because it would be clearly documented. Of course, we all know how well that tends to work.

Second, well-designed systems with good naming practices will make it fairly obvious most of the time what sort of arguments are expected, and what you can expect to get back. (This is related to the next point.)

Finally, coming from a "static" language, your brain just isn't trained to perform its own type inference and deal with duck typing. This is mostly a matter of practice, you get better at it. But if you aren't already familiar with various kinds of typing, be sure to do some reading. A better understanding of the differences will help make sense of what you're seeing.

[1] http://ipython.org/

1 comments

Another alternative is bpython