For dictionaries you can directly use structures like :
for (key, values) in dict:
and the key/values elements will be matching key and list of values.
But I'm not able to access them in this way.
Using reflection to list accessibles methods on the map I get :
__call__ x.__call__(...) <==> x(...)
__class__ instancemethod(function, instance, class) Create an
instance method object.
__cmp__ x.__cmp__(y) <==> cmp(x,y)
__delattr__ x.__delattr__('name') <==> del x.name
__get__ descr.__get__(obj[, type]) -> value
__getattribute__ x.__getattribute__('name') <==> x.name
__hash__ x.__hash__() <==> hash(x)
__init__ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
__new__ T.__new__(S, ...) -> a new object with type S, a subtype of T
__reduce__ helper for pickle
__reduce_ex__ helper for pickle
__repr__ x.__repr__() <==> repr(x)
__setattr__ x.__setattr__('name', value) <==> x.name = value
__str__ x.__str__() <==> str(x)
im_class None
im_func None
"values" function don't appear...
2008/6/19, Roman Yakovenko <rom...@gm...>:
> On Thu, Jun 19, 2008 at 10:16 AM, Vincent Ferries
> <vin...@gm...> wrote:
>> The method NastranDatabase.getNodes() has the following signature in
>> the C++ code : std::map<int,node> & getNodes(void) ;
>>
>> In my python code, I'm able to call it and get the corresponding
>> map_indexing_suite_map_less__int_comma__postLib_scope_nastran_scope_node__grate_
>> object.
>> When I iterate over this instance, I get the example listed above.
>> But don't know how to access corresponding int and NastranNode for
>> every element in the list...
>>
>> Hope this is better explained.
>
> A little bit.
>
> Iterating over std::map class is same as iterating over dictionary:
> you get tuple of <key, value>
> if you are interested in values only, you can use "values" function.
>
> Take a look on Py++ unittests.
>
> --
> Roman Yakovenko
> C++ Python language binding
> http://www.language-binding.net/
>
|