Skip to content

Instantly share code, notes, and snippets.

Avatar
📎
"It looks like you're writing a distributed web app!"

Brendan Smithyman bsmithyman

📎
"It looks like you're writing a distributed web app!"
View GitHub Profile
View AutomaticCythonImport
amodulename = 'modulename'
try:
import pyximport
pyximport.install()
except:
print('Cython import failed; {0} will use the legacy (pure Python) mode.'.format(amodulename))
from modulenamevanilla import class1, class2, class3
else:
try:
@bsmithyman
bsmithyman / JustTheNumbers
Last active Dec 17, 2015
Python gist to take a complicated nested object and grab a list of numbers from it.
View JustTheNumbers
import re
parser = re.compile('(?:[0-9\.]+)')
lambda x: [float(item) for item in parser.findall(repr(x))]