Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@qwdm
qwdm / gist:2a9d1e80890e6527516011478ce755e1
Created June 8, 2018 16:47 — forked from ulope/gist:1935894
Python: super(ClassName, self) vs. super(self.__class__, self)
"""Simple example showing why using super(self.__class__, self) is a BAD IDEA (tm)"""
class A(object):
def x(self):
print "A.x"
class B(A):
def x(self):
print "B.x"
super(B, self).x()
def iter_group(queue):
buf = []
prev_key = None
for val in queue:
cur_key, cur_val = val
#print cur_key, cur_val
if cur_key == prev_key or prev_key is None:
buf.append(cur_val)
else:
@qwdm
qwdm / websse.py
Last active August 29, 2015 14:11 — forked from werediver/websse.py
"""
Simple demonstration of how to implement Server-sent events (SSE) in Python
using Bottle micro web-framework.
SSE require asynchronous request handling, but it's tricky with WSGI. One way
to achieve that is to use gevent library as shown here.
Usage: just start the script and open http://localhost:8080/ in your browser.
Based on: