Skip to content

Add when arguments syntax.#1

Open
orez- wants to merge 2 commits into
masterfrom
when_arguments
Open

Add when arguments syntax.#1
orez- wants to merge 2 commits into
masterfrom
when_arguments

Conversation

@orez-
Copy link
Copy Markdown
Owner

@orez- orez- commented Apr 8, 2017

Allow for specifying named arguments to function with new syntax when, which omits the argument entirely when the value is falsey:

>>> import itertools
>>> i = itertools.count(1)
>>> dict(one=next(i), slurm=next(i) when bool(0), two=next(i), three=next(i) when bool(1), four=next(i))
{'one': 1, 'two': 2, 'three': 3, 'four': 4}

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant