Skip to content

Commit

Permalink
Merge pull request #389 from bozhodimitrov/main
Browse files Browse the repository at this point in the history
Examples for episode 564 & 565
  • Loading branch information
asottile authored Jan 14, 2024
2 parents 976ea39 + e62a4b6 commit 6a09150
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
45 changes: 45 additions & 0 deletions sample_code/ep564/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# [prefer tuples to lists! (intermediate)](https://youtu.be/8nvfOjvOF5w)

Today I talk about the three reasons why I prefer tuples over lists!

## Interactive examples

### Python

```python
lst = []
tup = ()

import sys

sys.getsizeof(lst)
sys.getsizeof(tup)

sys.getsizeof([1, 2, 3])
sys.getsizeof((1, 2, 3))

import dis

def f():
x = (1, 2, 3)
return x[1]


def g():
x = [1, 2, 3]
return x[1]


dis.dis(g)
dis.dis(f)

import subprocess
subprocess.check_call(['echo', 'hello hello world'])
subprocess.check_call(('echo', 'hello hello world'))
```

### Bash

```bash
python3
```
16 changes: 16 additions & 0 deletions sample_code/ep565/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# [git: inline diffs with --word-diff! (intermediate)](https://youtu.be/Wn3bJUzvy5I)

Today I show a tiny tip when working with patches in `git` (such as with `git diff` or `git log -p`) to show inline differences instead of full line differences

## Interactive examples

### Bash

```bash
git log --format= -p devenv/config.ini
git log --word-diff --format= -p devenv/config.ini

git log --word-diff-regex '[^[:space:]]' --word-diff --format= -p devenv/config.ini
git log --word-diff-regex '[a-f0-9]+|[^[:space:]]' --word-diff --format= -p devenv/config.ini
git log --word-diff-regex '[0-9]+|[a-f0-9]+|[^[:space:]]' --word-diff --format= -p devenv/config.ini
```

0 comments on commit 6a09150

Please sign in to comment.