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

dir() doesn't list attributes added to an object using, e.g., from_fits_file() #18

Open
tmcclintock opened this issue Dec 21, 2016 · 1 comment
Labels

Comments

@tmcclintock
Copy link
Collaborator

The function DataObject.from_fits_file() returns a cls(array) object containing data that was pulled out of a fits file. The columns should appear as attributes somewhere, but they are not listed when we run dir().

EXAMPLE:
In test_cluster.py in the setUp() function, we run:

self.cluster.members = GalaxyCatalog.from_fits_file(self.file_path + '/' + filename)

If we immediately write

print dir(self.cluster.members)

we see that 'z' doesn't appear on the list, even though on the very next line we see that 'z' is an attribute of members. This makes things difficult to debug because there is no easy way to find attributes spit out by fits files. I do not believe this is the intended behavior.

@erykoff
Copy link
Owner

erykoff commented Dec 21, 2016

You know, I never used the dir() command. Anyway, looking at the python documentation https://docs.python.org/2/library/functions.html#dir when you have custom __getattrribute__() you also need to set a custom __dir__(). So that needs to happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants