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

Option to element,get_value etc to return formatted string with units #107

Open
aawdls opened this issue Jul 9, 2019 · 2 comments
Open

Comments

@aawdls
Copy link
Contributor

aawdls commented Jul 9, 2019

It would be nice if we could get the unit name together with a value without having to go and get the unit conv object.

A possible implementation would be to add an optional argument e.g. formatted to e.g. element.get_value which would make it return a string with a few digits of precision and the units.

People may want then to specify the precision...

@willrogers
Copy link
Collaborator

#98 added the units but they're not that useful yet because of this.

@T-Nicholls
Copy link
Collaborator

This is a good idea. However, I would suggest a new method for returning formatted data like this for three reasons:

  • I think there are already lots of optional arguments to get_value, so I am cautious about adding more.
  • This feels like something ripe for future expansion, i.e. also returning the PV name, conversion limits ect., which would not be as feasible if it were embedded inside get_value.
  • Calling a method that then calls get_value and get_unitconv and then formats and returns the value and the appropriate units feels more intuitive to me than tacking it onto the end of get_value.

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