# Const double \*something

**URL:** <https://root-forum.cern.ch/t/const-double-something/13012>\
**Category:** ROOT\
**Created:** [August 31, 2011, 1:29pm UTC](https://root-forum.cern.ch/t/const-double-something/13012 "2011-08-31T13:29:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alessio](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/d6d6ee/32.png) [@alessio](https://root-forum.cern.ch/u/alessio)\
**Post date:** [August 31, 2011, 1:29pm UTC](https://root-forum.cern.ch/t/const-double-something/13012/1 "2011-08-31T13:29:50Z")

</div>

Maybe someone had already treated this issue, but I’m new and with a quick search I don’t’ find nothing related… So, sorry if I’m a repeater…

I’ve found that PyROOT has problem to understand this kind of variables in the classes. Practical example:

```auto
a = TAxis(3, [1., 2., 3.])
```

or

```auto
b = [1., 2., 3.]
a = TAxis(3, b)
```

he doesn’t recognize the second argument as an array (that in C++ is declared as “const double \*something”).  
Someone knows how to give an array as argument in this case?

Thanks to everyone…  
Alessio

---

<div class="post-metadata">

**Author:** ![LeWhoo](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/e8c25b/32.png) [@LeWhoo](https://root-forum.cern.ch/u/LeWhoo)\
**Post date:** [August 31, 2011, 1:53pm UTC](https://root-forum.cern.ch/t/const-double-something/13012/2 "2011-08-31T13:53:26Z")

</div>

Try giving as an argument a numpy array (for example numpy.array([1,2,3])).

---

<div class="post-metadata">

**Author:** ![alessio](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/d6d6ee/32.png) [@alessio](https://root-forum.cern.ch/u/alessio)\
**Post date:** [August 31, 2011, 3:30pm UTC](https://root-forum.cern.ch/t/const-double-something/13012/3 "2011-08-31T15:30:35Z")

</div>

Ok, it works… Thank you!!!

---

<div class="post-metadata">

**Author:** ![wlav](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/f07891/32.png) [@wlav](https://root-forum.cern.ch/u/wlav)\
**Post date:** [August 31, 2011, 6:17pm UTC](https://root-forum.cern.ch/t/const-double-something/13012/4 "2011-08-31T18:17:52Z")

</div>

Hi,

yes, the C++ side expects an array as a contiguous piece of memory. A python list is a list of pointers to python objects that wrap those doubles. An array from python module array would work as well. For numpy, make sure that the array is flat.

Cheers,  
Wim

---

<div class="post-metadata">

**Author:** ![alessio](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/d6d6ee/32.png) [@alessio](https://root-forum.cern.ch/u/alessio)\
**Post date:** [September 1, 2011, 3:39pm UTC](https://root-forum.cern.ch/t/const-double-something/13012/5 "2011-09-01T15:39:22Z")

</div>

Interesting… I’ve discovered python few months ago and I don’t now yet everything (especially such things).

At this point I’ve a question, but I’m going to ask in another tread ([url][SetFcn](https://root-forum.cern.ch/t/setfcn/12998/1)

Thanks for everything…
