Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve repr of siphon objects #260

Open
rabernat opened this issue Nov 30, 2018 · 1 comment · May be fixed by #284
Open

improve repr of siphon objects #260

rabernat opened this issue Nov 30, 2018 · 1 comment · May be fixed by #284
Labels
Area: Catalog good first issue Straightforward issues suitable for new and inexperienced contributors to the project Type: Enhancement

Comments

@rabernat
Copy link

rabernat commented Nov 30, 2018

I am trying to learn to use siphon. It seems very powerful. Thank you for creating it!

My usual method for learning a new library is to try to introspect the objects via a combination of doc strings, tab completion, etc (in addition to rtfm of course). One challenge with siphon is that it's __repr__ methods for its objects are often insufficiently informative, making it hard to quickly understand the datatypes returned by the different methods. For example.

>>> from siphon.catalog import TDSCatalog
>> cat_url = 'https://www.ncei.noaa.gov/thredds/catalog/avhrr-patmos-x-cloudprops-files/catalog.xml'
>> cat = TDSCatalog(cat_url)
>>> cat
No name found

I would have preferred to see

<siphon.catalog.TDSCatalog 'unnamed catalog'>

Or

>>> for k, v in cat.catalog_refs.items():
>>>     print(k, v)
>>>     break
1979 1979

Here this is especially confusing because k really is a string but v is a siphon.catalog.CatalogRef. Again, a better repr would be

<siphon.catalog.CatalogRef '1979'>

I believe that making these reprs more verbose would make the library easier to use for new users.

@dopplershift
Copy link
Member

Thanks for the feedback, that's very helpful. Originally, we had the default reprs, which just gave the class name and the default Python id, which was useless. Your feedback here is very helpful to see what a useful repr might look like.

@dopplershift dopplershift added Type: Enhancement Area: Catalog good first issue Straightforward issues suitable for new and inexperienced contributors to the project labels Dec 4, 2018
@dopplershift dopplershift added this to the Winter 2018 milestone Dec 4, 2018
@zbruick zbruick linked a pull request Oct 1, 2019 that will close this issue
2 tasks
@dopplershift dopplershift modified the milestones: 0.9, 0.10 Mar 5, 2021
@dopplershift dopplershift removed this from the 0.10 milestone Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Catalog good first issue Straightforward issues suitable for new and inexperienced contributors to the project Type: Enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants