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

Recipe name attribute? #194

Open
pgagne opened this issue Sep 25, 2020 · 2 comments
Open

Recipe name attribute? #194

pgagne opened this issue Sep 25, 2020 · 2 comments

Comments

@pgagne
Copy link
Contributor

pgagne commented Sep 25, 2020

Hey while working on recipe run export I needed to query the "name" of a recipe (ie TeamRecipe, BondRecipe). I was suprised to see there wasn't already a short variable for this and had to do recipe.__class__.__name__ instead.

I was thinking this might be useful for other people to have a shorter variable to get the name of a recipe, so I was thinking of adding a @property to BaseRecipe like the following

class BaseRecipe(object)
...
@property
def name(self):
    return self.__class__.__name__

The reason I am filling this issues is to get feedback. Do people think "name" is the right term, or is that too generic and likely conflict. shortname possibly?

@jtluka
Copy link
Collaborator

jtluka commented Sep 29, 2020

I think name is ok.

@olichtne
Copy link
Collaborator

I'm not sure about the use case for this, I understand that shortcuts like this can sometimes be useful, but I think this isn't something that's going to be used commonly.

  • from inside the recipe, you don't really need to refer to the recipes name
  • from internal LNST code, e.g. logging, it's better to treat Recipe classes as just another class and not depend on the shortcut existing
  • it does define the attribute as something specific and exported - all recipes will now have it and therefore the test developer can't use something as generic as name for their own purposes, this could be a potential downside
  • it could be useful for external tool integrations, but again, I'm not sure why not just use the object.class.name as if working with any other generic object instance in python...

Don't know, it feels a bit weird to me to export internal python attributes via shortcuts directly as part of an API.

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

3 participants