|
|
|
|
|
by NiceOneBrah
4725 days ago
|
|
As a newbie to Python, my biggest issue when coming up to speed on a new project is chasing down the types of arguments to and return values from functions. Previously I was a Java programmer and while I don't miss its verbosity, I do miss how I always knew what types I was working with. Does anybody have any tips that make this easier? |
|
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/