Browse Source

Splat

pull/27/head
Jure Šorn 5 years ago
parent
commit
6386f62aa8
1 changed files with 2 additions and 1 deletions
  1. 3
      README.md

3
README.md

@ -454,6 +454,7 @@ def f(<nondefault_args>, <default_args>) # def f(x, y=0)
Splat Operator
--------------
### Inside Function Call
**Splat expands collection into positional arguments, while splatty-splat expands dictionary into keyword arguments.**
```python
args = (1, 2)
kwargs = {'x': 3, 'y': 4, 'z': 5}
@ -466,7 +467,7 @@ func(1, 2, x=3, y=4, z=5)
```
### Inside Function Definition
**It combines zero or more positional arguments into tuple.**
**Splat combines zero or more positional arguments into tuple, while splatty-splat combines zero or more keyword arguments into dictionary.**
```python
def add(*a):
return sum(a)

Loading…
Cancel
Save