7

I am new to Python and using Python 2.7 on Windows I am using Astropy library, but when I want to view an attribute on the following class:

>>> astropy.cosmology.FlatLambdaCDM.Ok0

it returns:

<property object at 0x7fa2c7e206d8>

Same for other attributes on that object. How do I access the numerical values?

Iguananaut
  • 21,810
  • 5
  • 50
  • 63
Sibte Raza
  • 187
  • 1
  • 3
  • 7
  • possible duplicate of [How do Python properties work?](http://stackoverflow.com/questions/6193556/how-do-python-properties-work) – Iguananaut Aug 05 '14 at 17:07

1 Answers1

9

I don't know anything about astropy myself, but from your description it soulds like Ok0 is a property of the FlatLambdaCDM class. You're usually not supposed to try to access properties on a class directly, but rather through an instance of the class.

Try something like:

# create an instance
instance = FlatLambdaCDM()  # the constructor may require some arguments

# access the property on the instance
instance.Ok0

I don't know what arguments (if any) the FlatLambdaCDM class constructor requires, so you may need to add some more stuff to get a workable object.

Blckknght
  • 100,903
  • 11
  • 120
  • 169