Skip to content

Instantly share code, notes, and snippets.

View k7hoven's full-sized avatar

k7hoven

  • Helsinki, Finland
View GitHub Profile
@k7hoven
k7hoven / demo.txt
Last active March 30, 2016 17:36
Ridiculous, broken, hacky and flawed implementation of StringPath, instances of which are both instances of pathlib.Path and of str
>>> p = StringPath("foo/bar/baz")
>>> p
StringPath(PosixPath('foo/bar/baz'))
>>> isinstance(p, pathlib.Path)
True
>>> isinstance(p, str)
True
>>> str(p)
'foo/bar/baz'
>>> p + 'hello'
@k7hoven
k7hoven / oneline.py
Last active April 18, 2016 14:51
oneline.py .-- draft Python 3.5+ module to execute/evaluate lines of code with automatic imports
#!/usr/bin/env python3
# coding: utf-8
# Written by Koos Zevenhoven, after the python-ideas discussion
# and code by 'Random832' here:
# https://mail.python.org/pipermail//python-ideas/2016-April/039448.html
import types
import sys
import importlib