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
It's confusing that dict key-values can be declared with either : or = and even mixed:
data = {
key1 = "value1",
key2 : "value2"
}
The tour uses examples with =, while the spec uses examples with :. But none of the docs really states the formal syntax, mentions the interchangeability, or states the preferred/recommended syntax.
In the code style section, there is the mixed example:
d1 = {labels: {k1 = "v1"}}
Here the colon : is referred to dict "instantiation" and equality = referred to as "override attribute operator". But it is unclear whether the difference is syntactical sugar or is functionally different.
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It's confusing that dict key-values can be declared with either
:
or=
and even mixed:The tour uses examples with
=
, while the spec uses examples with:
. But none of the docs really states the formal syntax, mentions the interchangeability, or states the preferred/recommended syntax.In the code style section, there is the mixed example:
Here the colon
:
is referred to dict "instantiation" and equality=
referred to as "override attribute operator". But it is unclear whether the difference is syntactical sugar or is functionally different.Beta Was this translation helpful? Give feedback.
All reactions