To overcome the ipython object limitation when it comes to introspection or reflection features I use this little helper script described here Custom magic function in IPython session. Below is an example session howto use in practice (in line you press TAB to let the ipython introspect the object)
ipython -i bpython-pyrax.py In [1]: cs.images.list() 19:51:28 Out[1]: [<Image: Ubuntu 13.04 (Raring Ringtail)>, <Image: Gentoo 13.1>, <Image: Fedora 18 (Spherical Cow)>, truncated ... In [2]: rl ------> rl() created variable l0 = <Image: Ubuntu 13.04 (Raring Ringtail)> created variable l1 = <Image: Gentoo 13.1> created variable l2 = <Image: Fedora 18 (Spherical Cow)> created variable l3 = <Image: FreeBSD 9.1> created variable l4 = <Image: Ubuntu 12.10 (Quantal Quetzal)> created variable l5 = <Image: Ubuntu 12.04 LTS (Precise Pangolin)> created variable l6 = <Image: Ubuntu 10.04 LTS (Lucid Lynx)> created variable l7 = <Image: Red Hat Enterprise Linux 6.3> list cs.images.list() has 45 elements but only 7 was printed In [3]: l0. l0.HUMAN_ID l0.created l0.id l0.metadata l0.progress l0.NAME_ATTR l0.delete l0.is_loaded l0.minDisk l0.set_loaded l0.OS-DCF:diskConfig l0.get l0.links l0.minRam l0.status l0.OS-EXT-IMG-SIZE:size l0.human_id l0.manager l0.name l0.updated In [5]: l0.name Out[5]: u'Ubuntu 13.04 (Raring Ringtail)'References
No comments:
Post a Comment