TEventList ownership in pyroot and argument conversion

I am having trouble working with TEventLists in pyroot. The following commands work fine in ROOT:
(suppose I have an eventlist called ev and a TTree t)

t->SetEventList(0);
ev->SetDirectory(0);

but in Python I get:

>>> t.SetEventList(0)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: void TTree::SetEventList(TEventList* list) =>
    could not convert argument 1

>>> ev.SetDirectory(0)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: void TEventList::SetDirectory(TDirectory* dir) =>
    could not convert argument 1

So what’s the corresponding argument in python and how can I own the eventlist? I want to remove it from gDirectory because I have a loop that creates another one with the same name.

Hello,

you do not post which version of ROOT you are using, so I’m going to assume that you are using a recent one. Please use ‘ROOT.NULL’ instead of 0.
Not allowing ‘0’ or ‘None’ to represent the null pointer is one of the more debatable choices that I made, but it is meant to cause an exception if in:

GetPointer() returns None or 0.

If you know for sure that GetPointer() returning the null pointer to DoSomething() is not going to cause trouble and you don’t want to see an exception in that case, then you do:

Also, if you want to have a null pointer that has an explicit type (e.g. for overloading or to pass as an MyClass** argument), you can use ROOT.MakeNullPointer( ).

HTH,
Wim

Thanks. It works fine. I’m using version 5.02.