Re: [RFC][patch 2/9] export values mechanism to Python

Tom Tromey
2008-06-03T00:19:24Z

>>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:

Daniel> Would it be helpful or confusing to automatically expose this
Daniel> as [] in Python, __getitem__?

Good question.

In general I've been using explicit method names, like get_* and
set_*. But perhaps we should be using attributes and various
"intrinsic" names... I'm not enough of a Python expert to know what is
preferred.

Also, about the varobj patch in particular: I notice that it is
MI-specific. At least for type visualizers I think I would like
something that works with 'print' as well. I'm thinking:

* A way to register a type->object mapping from Python

* A new method on the Python object (if needed -- I'm not an expert in
this area) to return the 'print' form of the value. (If a new
method is needed this, I think, implies that we should not use
__str__ here.)

* Modifications to 'print' and friends

* A new 'raw' format to print to let us bypass the custom printer and
just show whatever the language defaults to.

Let me know what you think of this general plan.

Tom