Accessing class instance variables with vars().

Erik Max Francis max at
Thu Feb 6 01:03:42 CET 2003

Andrew Bennetts wrote:

> I think I'd probably join them with:
>     d = vars()
>     d.update(vars(A))
>     print '....' % d

I'd think you'd probably want those in reverse order, so as to mimic the
search order that Python itself would take when doing a getattr.

 Erik Max Francis / max at /
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ It comes from inside, and that's what I consider to be soul music.
\__/ Sade Adu
    Esperanto reference /
 An Esperanto reference for English speakers.

More information about the Python-list mailing list