Feed on
Posts
Comments

when debugging or trying to understand someone else’s python code, it can be helpful to know what variables and methods are associated with an object.  to get that information, use the dir() method:

(Pdb) dir(pylab.cm.RdBu)

['N', '__call__', '__doc__', '__init__', '__module__', '_gamma', '_i_bad', '_i_over', '_i_under', '_init', '_isinit', '_lut', '_rgba_bad', '_rgba_over', '_rgba_under', '_segmentdata', '_set_extremes', 'from_list', 'is_gray', 'monochrome', 'name', 'set_bad', 'set_gamma', 'set_over', 'set_under']


Bookmark and Share

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

Did I get this wrong? Let me know!

Trackback URI | Comments RSS