structured dict macro #2162
off-by-one
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
I think your code will do the wrong thing if there are collection-type models in the arguments, as in For what it's worth, I like to put two spaces between key-value pairs in dictionaries, so it's clearer what belongs to what:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I found the default dict syntax a bit hard to read, but the macros made it really easy to introduce custom syntax. You can do it with a one-liner (fixed thanks to Kodiologist):
And can apply the macro to
{(1 => 2) (3 => 4)}
(or if you prefer Python style,{(1: 2) (3: 4)}
).I like
deftag %
(ordefmacro "#%"
in 1.0), since it gives you#%{(1 => 2) (3 => 4)}
, which is similar to Perl and also suggestively close to the set notation.Beta Was this translation helpful? Give feedback.
All reactions