Skip to content
Snippets Groups Projects
Commit 729fb25b authored by Martyn Gigg's avatar Martyn Gigg
Browse files

Use isinstance for object type check

parent 5d3c9839
No related branches found
No related tags found
No related merge requests found
...@@ -116,7 +116,8 @@ The returned object can then be used to call other methods that belong to ``Spec ...@@ -116,7 +116,8 @@ The returned object can then be used to call other methods that belong to ``Spec
# Get a SpectrumDefinition object # Get a SpectrumDefinition object
spectrumDefinition = info.getSpectrumDefinition(0) spectrumDefinition = info.getSpectrumDefinition(0)
print(type(spectrumDefinition)) from mantid.api import SpectrumDefinition
print("The type is SpectrumDefinition: {}".format(isinstance(spectrumDefinition, SpectrumDefinition)))
Output: Output:
...@@ -124,7 +125,7 @@ Output: ...@@ -124,7 +125,7 @@ Output:
10.0 10.0
[0,0,-10] [0,0,-10]
<class '_api.SpectrumDefinition'> The type is SpectrumDefinition: True
*bases:* :py:obj:`mantid.api.SpectrumInfo` *bases:* :py:obj:`mantid.api.SpectrumInfo`
...@@ -135,4 +136,3 @@ Output: ...@@ -135,4 +136,3 @@ Output:
:members: :members:
:undoc-members: :undoc-members:
:inherited-members: :inherited-members:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment