There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
BUG -- Expansion of Locals node gives wrong object
I have a Python program which uses a C extension called
PyGLPK, version 0.3. It has a class
LPX with two members
cols of class
BarCollection. These collections have sequence behavior as well as mapping behavior, as in
cols. The member rows and columns are of class
Bar. They have an attribute
index which matches its position in the collection's sequence.
PTVS shows the numerically indexed elements as
, ,... The name for
 reads something like
<glpk.Bar, row 10 of glpk.LPX ...>. However, if I expand
 I get the children of a different member of the collection, which I can tell because it has an
index attribute which is not 10.
Now, if I type in
list (mylpx.rows), I do get a list where
 expands to something have
index = 10.
If I Add Watch for item  in the expansion of
mylpx.rows, it adds an item named
mylpx.rows, which gives the correct result.
Here's a copy of the implementation for the
BarCollection class and its related
BarCollectionIter class (attached). You may also find the
LPK implementations also useful, so I've attached these as well. If you need more, you can look up PyGLPK on the Python Packages site. To test this out yourself, you may want to load the GLPK and build the extension rather than try to simulate
what it does. The extension methods use the underlying objects maintained by the GLPK library to get and set some of the attributes.
BTW, this package is a wrapper around the GNU Linear Programming Kit (GLPK) which comes as a DLL.