Re: std::vector<Bool_t> in PyROOT

From: Tim Head <betatim_at_gmail.com>
Date: Mon, 28 Jun 2010 23:33:37 -0500


Hi Wim

On 28 June 2010 23:11, <wlavrijsen_at_lbl.gov> wrote:
> Akira,
>
>>  File "test.py", line 27, in <module>
>>   print b[i]
>> TypeError: 'vector<bool,allocator<bool> >' object does not support
>> indexing
>
> typically means that there's no dictionary loaded for said vector class.

It doesn't, well __getitem__() is missing:

['__assign__', '__class__', '__delattr__', '__dict__', '__doc__',
'__eq__', '__format__', '__ge__', '__getattribute__', '__gt__',
'__hash__', '__init__', '__le__', '__len__', '__lt__', '__module__',
'__ne__', '__new__', '__nonzero__', '__reduce__', '__reduce_ex__',
'__repr__', '__setattr__', '__sizeof__', '__str__',
'__subclasshook__', '__weakref__', 'assign', 'begin', 'capacity',
'clear', 'empty', 'end', 'erase', 'insert', 'max_size', 'pop_back',
'push_back', 'rbegin', 'rend', 'reserve', 'resize', 'size', 'swap', 'vector']

How do you get a dictionary to be loaded and why do the others get loaded automagically?

Tim

-- 
http://tim.jottit.com/
Received on Tue Jun 29 2010 - 06:33:45 CEST

This archive was generated by hypermail 2.2.0 : Tue Jun 29 2010 - 11:50:01 CEST