You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently I have been feeling more and more ways to realise that julia is well designed. One instance of this is when I realized something about keyword arguments, and why non keyword arguments are unmentionable in function calls. I mean:
In python:
defmyfun(a, *, b):
print(a, b)
myfun(1, b=3) # does and should work# myfun(1, 3) # does not and should not work# butmyfun(a=1, b=3) # works but is confusing, in julia is illegal
Julia takes a clear stance on this, the reason for this to me, even still, was only partially motivated, until today when I found myself thinking about broadcasting over keyword arguments.
"Keyword arguments are not broadcasted over, but are simply passed through to each call of the function. For example, round.(x, digits=3) is equivalent to broadcast(x -> round(x, digits=3), x)."
I don't have a use-case for broadcasting over keyword arguments, but
(
decision A=> keyword arguments unmentionable in function calls,
decision B=> broadcasting over keyword arguments is illegal
)
Could someone kindly clarify, I am just curious about both of the decisions and if there is any connection between both of these design choices?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Recently I have been feeling more and more ways to realise that julia is well designed. One instance of this is when I realized something about keyword arguments, and why non keyword arguments are unmentionable in function calls. I mean:
In python:
Julia takes a clear stance on this, the reason for this to me, even still, was only partially motivated, until today when I found myself thinking about broadcasting over keyword arguments.
The docs mentioned this:
I don't have a use-case for broadcasting over keyword arguments, but
Could someone kindly clarify, I am just curious about both of the decisions and if there is any connection between both of these design choices?
Beta Was this translation helpful? Give feedback.
All reactions