3 ms·
To complement what other people are recommending here, I'd say that in cases like this I only sometimes read the documentation. Other times I put a line in my c
by lars512 16y ago
To complement what other people are recommending here, I'd say that in cases like this I only sometimes read the documentation. Other times I put a line in my code:
import pdb; pdb.set_trace()
which makes it enter the debugger at that point, and I simply inspect the object that I'm really getting, looking at what it supports, the documentation on its methods, etc.
Doing it this way is not always feasible, since sometimes there's a prohibitive amount of setup code that needs running before you can get a real object. For short code paths though, like Django apps, it works really well.