Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
_tarray.pyzdoc
Go to the documentation of this file.
1/**
2\class TArray
3\brief \parblock \endparblock
4\htmlonly
5<div class="pyrootbox">
6\endhtmlonly
7## PyROOT
8
9When used from Python, the subclasses of TArray (TArrayC, TArrayS, TArrayI, TArrayL, TArrayF and TArrayD) benefit from the following extra features:
10
11- Their size can be obtained with `len`, which is equivalent to TArray::GetSize():
12\code{.py}
13import ROOT
14
15a = ROOT.TArrayD(2)
16print(len(a)) # prints '2'
17\endcode
18
19- Their elements can be read and written with the `getitem` and `setitem` operators, respectively:
20\code{.py}
21a[0] = 0.2
22a[1] = 1.7
23print(a[0]) # prints '0.2'
24\endcode
25
26- They are iterable:
27\code{.py}
28for elem in a:
29 print(elem)
30\endcode
31\htmlonly
32</div>
33\endhtmlonly
34*/