Skip to content

Instantly share code, notes, and snippets.

View daevaorn's full-sized avatar

Alexander Koshelev daevaorn

View GitHub Profile
from itertools import izip
def chunkify(iterable, chunk_size):
r"""
>>> chunkify(range(1, 11), 2)
[(1, 2), (3, 4), (5, 6), (7, 8), (9, 10)]
"""
_iterable = iter(iterable)
return izip(*[_iterable] * chunk_size)
# Simple way to see which version of django apps you have
# Author: Alexander Artemenko
import pkg_resources
from django.conf import settings
def get_version(app):
try:
d = pkg_resources.get_distribution(app)
return d.project_name, d.version