Skip to content

Instantly share code, notes, and snippets.

View bekzat-shayakhmet's full-sized avatar

Бекзат Шаяхмет bekzat-shayakhmet

View GitHub Profile
@bekzat-shayakhmet
bekzat-shayakhmet / fibonacci.py
Last active December 19, 2020 11:23 — forked from wzpan/fibonacci.py
Python - Fibonacci Iterator
class Fib:
def __init__(self, max):
self.max = max
def __iter__(self):
self.a = 0
self.b = 1
return self
def __next__(self):
@bekzat-shayakhmet
bekzat-shayakhmet / async.py
Created August 28, 2020 09:42 — forked from phizaz/async.py
Python turn sync functions to async (and async to sync)
import functools
def force_async(fn):
'''
turns a sync function to async function using threads
'''
from concurrent.futures import ThreadPoolExecutor
import asyncio
pool = ThreadPoolExecutor()