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

Enhanced help output #238

Closed
eminence opened this issue Nov 8, 2023 · 1 comment
Closed

Enhanced help output #238

eminence opened this issue Nov 8, 2023 · 1 comment

Comments

@eminence
Copy link
Contributor

eminence commented Nov 8, 2023

Now that we have additional metadata (via 9921465) and a new help command (via #222) maybe we can combine them :)

Here's an example for how an enhanced help(electronvolt) might look:

>>> help(electronvolt)

Electronvolt
https://en.wikipedia.org/wiki/Electronvolt
Aliases: electronvolts, eV
A unit of [Energy]

  = 1.602176634e-19 joule [Energy]

We don't currently have metadata on constants, but maybe we could also imagine a yet further extension:

# The Planck constant 
@name("Planck Constant")
@url("https://en.wikipedia.org/wiki/Planck_constant")
let planck_constant: Action = 6.62607015e-34 J / Hz
let ℎ = planck_constant
>>> help(ℎ)

Plank Constant
https://en.wikipedia.org/wiki/Planck_constant
A unit of [Action]

   =  6.62607015e-34 J / Hz [Action]
@sharkdp
Copy link
Owner

sharkdp commented Nov 9, 2023

Thank you for the feedback. Great idea!

I think I would change the syntax to just help electronvolt because help is really a command (handled by the CLI or WebInterface directly), and not actual Numbat syntax. You couldn't use it in a Numbat program.

We don't currently have metadata on constants, but maybe we could also imagine a yet further extension:

Yes, I thought about that as well. We should definitely allow some of the decorators to also be usable on constants. @aliases also makes sense on constants. This would allow us to associate planck_constant with directly:

# The Planck constant 
@name("Planck Constant")
@url("https://en.wikipedia.org/wiki/Planck_constant")
@aliases(ℎ)
let planck_constant: Action = 6.62607015e-34 J / Hz

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

No branches or pull requests

2 participants