Skip to content

Commit

Permalink
docs: dict comprehension
Browse files Browse the repository at this point in the history
  • Loading branch information
niekdt committed Jul 30, 2024
1 parent b108e80 commit 42a2d80
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/actionsheets/data/python/collections/dict.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ code = "x = {'color': 'blue', 'size': 'large'}"
action = "Define with integer keys"
code = "x = {1: 'a', 2: 'b', 3: 'c'}"

[create.comprehension]
action = "Generate from comprehension over list of keys"
code = """
keys = ['a', 'b', 'c']
{key: key.upper() for key in keys}
"""

[create.iter.fill]
action = "Define from keys iterator and constant value _v_"
code = "dict.fromkeys(key_iter, v)"
Expand Down

0 comments on commit 42a2d80

Please sign in to comment.