Skip to content

Instantly share code, notes, and snippets.

View JulienPalard's full-sized avatar
🐍
🐍

Julien Palard JulienPalard

🐍
🐍
View GitHub Profile
@JulienPalard
JulienPalard / asynczip.py
Created April 2, 2016 19:09
Aggregation of asynchronous iterables
import asyncio
SOON = 'SOON'
PAIRED = 'PAIRED'
class AsyncZip:
"""Aggregates async iterables, like `zip` or `select`.
The current state is stored in `self.iterating` as the `__anext__()`
@JulienPalard
JulienPalard / mail-parse.py
Created February 16, 2016 15:10
Not-so-good example of mail header / body parsing
import os
import re
import sys
from email.parser import Parser
from email.header import decode_header
import logging
logger = logging.getLogger(__name__)
@JulienPalard
JulienPalard / curry.py
Created August 1, 2014 10:51
KISS Python curry
#!/usr/bin/env python
def curry(func):
"""
Decorator to curry a function, typical usage:
>>> @curry
... def foo(a, b, c):
... return a + b + c