Skip to content

Commit

Permalink
Merge pull request #372 from int3l/main
Browse files Browse the repository at this point in the history
Code examples for episode 551
  • Loading branch information
asottile authored Aug 27, 2023
2 parents ccde541 + b80612e commit afb998c
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions sample_code/ep551/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# [tuple syntax doesn't have parens (beginner - intermediate)](https://youtu.be/EDGJ2TMuppM)

Today we talk about tuples in python -- and surprisingly they don't actually use parens for syntax most of the time! I show off a little pitfall caused by this as well

## Interactive examples

### Python

```python
x = (1, 2, 3)
x

x = 1, 2, 3
x

import ast
ast.parse('x = (1, 2, 3)').body[0].value
ast.parse('x = (1, 2, 3)').body[0].value.col_offset

x = (
1,
2,
3,
)

print((1, 2, 3),)
print((1, 2, 3))
print((1, 2, 3), 4)

x = ()
x

x = min(5, 4),
x

print(
min(5, 4),
)
```

### Bash

```bash
python
```

0 comments on commit afb998c

Please sign in to comment.