print object attributes recursively

TerryP bigboss1964 at gmail.com
Wed Sep 30 13:18:55 EDT 2009


On Sep 30, 1:49 pm, Piet van Oostrum <p... at cs.uu.nl> wrote:
> I don't know what print_r does, but in your example above
>
> print [x.L for x in t.M] would work.
>
> Probably you would split this into two methods in X and Y.
> --
> Piet van Oostrum <p... at vanoostrum.org>
> WWW:http://pietvanoostrum.com/
> PGP key: [8DAE142BE17999C4]

PHP's print_r() is basically a recursive pretty printer; if you know
Perl, think of it as PHPs idea of Data::Dumper.


Personally, when I want to know whats in something, I invoke dir() on
it and filter the results accordingly. Whether it is smart or stupid,
it works well at an interactive prompt.



More information about the Python-list mailing list