redodo/tortilla — pull request #15 by aelse (2014-12-16 08:46:09+00:00)
Title: Fix string join with pk

Exception generated when pk is used in a get()

```python
>>> poke = tortilla.wrap('http://pokeapi.co/api/v1/')
>>> poke.ability.get(4)
Traceback (most recent call last):
File "", line 1, in
File "/tmp/foo/local/lib/python2.7/site-packages/tortilla/wrappers.py", line 315, in get
return self.request('get', pk, **options)
File "/tmp/foo/local/lib/python2.7/site-packages/tortilla/wrappers.py", line 291, in request
options['url'] = '/'.join([self.url(), pk])
TypeError: sequence item 1: expected string, int found
```

Patch uses string format instead of join. As a bonus, format appears faster than join for this case.

```python
import timeit

def bench_join():
'/'.join(['abc', '1']) # pk as string, required by string join

time_join = timeit.Timer(bench_join)
min(time_join.repeat(repeat=10, number=1000000))

result: 0.26717209815979004

def bench_format():
'{}/{}'.format('abc', 1) # pk as integer

time_format = timeit.Timer(bench_format)
min(time_format.repeat(repeat=10, number=1000000))

result: 0.22851991653442383
```