-
-
Notifications
You must be signed in to change notification settings - Fork 47
Prohibition on length-1 tuples can make laplace functions annoying to use #1518
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
Comments
I like the length-one tuple option with Python syntax I suppose it wouldn't work syntactically to just have |
Allowing them universally should be pretty easy, the difficulty is if you want to preserve them during auto-formatting. We could just say "the formatter will remove any optional trailing commas", but usually people put them there for a good reason. Of course, we could do this for now and try to improve the formatting later.
We might run into issues with the fact that |
We could have the formatter default to the trailing comma. I have come to like it in Python to visually distinguish tuple parens from regular parens. |
I also like the trailing commas approach. Though In the math library I could check if the input argument is not a tuple and if so wrap it in one. |
Though I think doing this for laplace would trick users into thinking that |
|
Correct, I am assuming whatever we decide it would not actually be in 2.37 |
|
@avehtari ran into this today, where he wanted to define a covariance function that takes only a single argument.
The prohibition is purely syntactic, because
(1.0)
is already equivalent to1.0
(e.g. areal
).Some options:
(1.0, )
singleton_tuple(1.0)
)All of these have a bit of a "magic" feel that makes me uneasy. The first is the most general, but we specifically avoided allowing this in the original tuples PR
The text was updated successfully, but these errors were encountered: