Skip to content

Format specifiers: how to use the "alternatives" thing with the "conditional" specifier? #2833

Answered by mikf
Nuthouse01 asked this question in Q&A
Discussion options

You must be logged in to vote

Well, this is "expected" behavior, but it should definitely be improved.

The correct way of specifying NONE as alternative would be
{tags_character[0:5]|'NONE':J+/}
but applying J, i.e. str.join(), to another string results in N+O+N+E,
so you are currently forced to use the branching behavior.

I will push a commit that changes this behavior to not join strings, only lists, the next time I do a git push.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mikf
Comment options

Answer selected by mikf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment