Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
joelgrus committed Oct 22, 2015
1 parent f023ca8 commit 25d57d4
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions code-python3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,30 @@ This was mostly just tedious. I should have used 2to3.
tuple unpacking in function parameters. In particular, that means that code like

```
key=lambda (a, b): b
lambda (a, b): b
```

has to be replaced with

```
key=lambda pair: pair[1]
lambda pair: pair[1]
```

This is unfortunate, as I tend to write a lot of code like

```
sorted(words_and_counts, key=lambda (word, count): count, reverse=True)
```

Probably I should have just created a `helpers.py` with a few functions like

```
def fst(pair): return pair[0]
def snd(pair): return pair[1]
```

Maybe next time.

## laziness

In Python 3, laziness is the order of the day. In particular, `dict`-like
Expand Down

0 comments on commit 25d57d4

Please sign in to comment.