|
@@ -8,7 +8,6 @@ from django.shortcuts import render
|
|
|
from ujson import dumps as uj_dumps
|
|
|
import random
|
|
|
from operator import attrgetter
|
|
|
-import numpy.random as nprnd
|
|
|
from functools import partial
|
|
|
|
|
|
def json(request):
|
|
@@ -31,12 +30,9 @@ def db(request):
|
|
|
# one can eliminate dereferences by storing the end dereferenced thing in an identifier
|
|
|
g = World.objects.get
|
|
|
#r = random.randint
|
|
|
- # but wait! there's more!
|
|
|
- #http://stackoverflow.com/questions/4172131/create-random-list-of-integers-in-python
|
|
|
- #r = nprnd.randint
|
|
|
# but wait! there's more! if we're calling a function over and over with the same parameters,
|
|
|
# we can use even more function magic.
|
|
|
- rp = partial(nprnd.randint, 1, 10000)
|
|
|
+ rp = partial(random.randint, 1, 10000)
|
|
|
# now we're ready to write our awesome query iterator thingy
|
|
|
# first of all, we know the id's correspond to the random number we're picking, so we can create
|
|
|
# dictionaries on the fly instead of serializing later
|