Skip to content

[skip-ci][rfile] Add RFile python doc - #23633

Open
silverweed wants to merge 1 commit into
root-project:masterfrom
silverweed:rfile_doc_py
Open

silverweed wants to merge 1 commit into
root-project:masterfrom
silverweed:rfile_doc_py

Conversation

@silverweed

Copy link
Copy Markdown
Contributor

No description provided.

@vepadulano vepadulano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! A few comments from my side.

Comment thread bindings/pyroot/pythonizations/python/ROOT/_pythonization/_rfile.py Outdated
Comment thread bindings/pyroot/pythonizations/python/ROOT/_pythonization/_rfile.py Outdated
Comment thread bindings/pyroot/pythonizations/python/ROOT/_pythonization/_rfile.py Outdated
\code{.py}
# Reading an object from file. Note that Get will return None if no object is stored under the given path.
with ROOT.Experimental.RFile.Open("myfile.root") as file:
myHisto = file.Get("myHisto")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a side note, other Python interface e.g. the dictionary have a get method which raises error by default and optionally returns a default argument which could be None e.g. get("mykey", None).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently the behavior on the C++ side; if we strongly believe we should change it we should change it for both languages, but I'd avoid having it behave differently. We still have a bit of time to decide before moving RFile out of Experimental.

Comment thread bindings/pyroot/pythonizations/python/ROOT/_pythonization/_rfile.py
Comment thread bindings/pyroot/pythonizations/python/ROOT/_pythonization/_rfile.py Outdated
Comment thread bindings/pyroot/pythonizations/python/ROOT/_pythonization/_rfile.py Outdated

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants