Skip to content

Instantly share code, notes, and snippets.

@macro1
macro1 / time_dict_merge.py
Last active February 23, 2016 06:29 — forked from treyhunner/time_dict_merge.py
Test performance of different dictionary merging functions in Python
"""
Results:
multiple_update: 92 ms
copy_and_update: 92 ms
dict_constructor: 93 ms
kwargs_hack: 93 ms
dict_comprehension: 91 ms
concatenate_items: 327 ms
union_items: 325 ms
@macro1
macro1 / tree.py
Created November 1, 2015 02:31
Reimplementation of basic Unix-style tree command in Python.
#! /usr/bin/env python
"""Reimplementation of basic Unix-style tree command in Python 3."""
import argparse
from os import listdir, path
def print_tree(top, prefix=''):
print('{prefix}{base_name}'.format(
prefix=prefix, base_name=path.basename(top)))

Keybase proof

I hereby claim:

  • I am macro1 on github.
  • I am macro1 (https://keybase.io/macro1) on keybase.
  • I have a public key whose fingerprint is E752 B5F0 6482 E128 C8FF 3979 FDF6 535D FDB4 2BDC

To claim this, I am signing this object: