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

Better description or conceptualization of gsa_dict #1

Open
cmutel opened this issue Sep 9, 2020 · 0 comments
Open

Better description or conceptualization of gsa_dict #1

cmutel opened this issue Sep 9, 2020 · 0 comments

Comments

@cmutel
Copy link
Collaborator

cmutel commented Sep 9, 2020

This could be much easier to use, especially for people who aren't well-versed in the literature.

  1. Think hard about whether you want to continue to use X, etc. variable names. I don't think we lose anything by being a bit more descriptive.

  2. I go back and forth on this, but my conclusion right now is that this object should be a subclass of dict:

from collections import UserDict

class GSA_Dict(UserDict):
    def __str__(self):
        return "GSA_Dict instance with the following keys:\n{}".format("|".join(key for key in self))

This subclass a) makes it clear that this is a "special" object, b) allows for nicer string representation in the shell, and c) allows you to add custom methods, if desirable, in the future.

  1. There is a lot of code like:
self.gsa_dict.update({'X': self.generate_samples()})

Is there a reason that we can't just say:

self.gsa_dict['X'] = self.generate_samples()

This is a lot easier to parse, at least for me.

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

No branches or pull requests

1 participant