Jorge Vargas wrote:

> well after all it's a function so the only ways you can get things out
> of it are:
> - return a dict with all the objects
> - use global (very messy)
> - use a decorator to do either of the above.

Messy, all of those... :(.

> on the other hand have you consider using a proper test package?
> instead of inspecting the objects manually from the shell you could
> make it all automatic. with assert statements. you could use the std.
> python testing modules http://docs.python.org/lib/development.html or
> something less verbosed like nose

Usually, I'm using standard Python testing modules, but sometimes that is
just an overkill. Sometimes I like to do 'exploratory programming',
especially in the early phases of development - create a bunch of objects I
want to play with and do that from IPython. Only way I found out to
somewhat automate this procedure is to have a function that creates all of
the test objects, and then raises an exception at the end. IPython starts
ipdb, so I can work with the objects the function created (without copying
them back to the shell). But this somehow looks too hack-ish for me, so I
was wondering if there was an alternative...

Anyway, thanks for your answer ;).

-- 
Karlo Lozovina -- Mosor
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to