astropy/astropy — pull request #855 by taldcroft (2013-03-07 21:22:52+00:00)
Title: Improve usability of ConfigurationItem

Not having carefully read the documentation, the first time I was confronted with a `ConfigurationItem` as a user (testing the VO conesearch), I found it difficult to use. In particular there is no obvious way to get the value. The ``__str__`` and ``__repr__`` methods are not defined, so printing a config item shows nothing useful. I tried to do tab-completion to see an attribute that would give me the value, and saw everything about the item *except* the value.

This PR tries to fix that. Here is an example:
```
In [1]: from astropy.utils.data import DATAURL, REMOTE_TIMEOUT

In [2]: DATAURL
Out[2]:

In [3]: print DATAURL
ConfigurationItem: 'dataurl'
cfgtype='string'
defaultvalue='http://data.astropy.org/'
description='URL for astropy remote data site.'
module=astropy.utils.data
value='http://data.astropy.org/'

In [4]: DATAURL.value
Out[4]: 'http://data.astropy.org/'

In [5]: REMOTE_TIMEOUT
Out[5]:

In [6]: print REMOTE_TIMEOUT
ConfigurationItem: 'remote_timeout'
cfgtype='float'
defaultvalue=3.0
description='Time to wait for remote data query (in seconds).'
module=astropy.utils.data
value=3.0
```

The details of what to return for `__str__` and `__repr__` are open to discussion.

I think that calling a config item as a function to get it's value is unintuitive, and that's where I had to read the docs to find the answer. This PR adds an property `value` that is currently read only. Adding this property might be controversial from the "one and preferably only one way" perspective, but my feeling is that this will be generally be more intuitive.