From 0855525fca15296d8f901f7b9efe0d4f3cb494a4 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 18 Apr 2011 12:49:37 -0400 Subject: [PATCH] added eng.join example --- examples/eng_join.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 examples/eng_join.py diff --git a/examples/eng_join.py b/examples/eng_join.py new file mode 100644 index 0000000..c2736b1 --- /dev/null +++ b/examples/eng_join.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import sys +import os + +sys.path.insert(0, os.path.abspath('..')) + +from clint.eng import join +from clint.textui import colored, indent, puts + +colors = [ + colored.blue('blue'), + colored.red('red'), + colored.yellow('yellow'), + colored.green('green'), + colored.magenta('magenta') +] + +colors = map(str, colors) + + +puts('Smart:') +with indent(4): + for i in range(len(colors)): + puts(join(colors[:i+1])) +puts('\n') +puts('Stupid:') +with indent(4): + for i in range(len(colors)): + puts(join(colors[:i+1], im_a_moron=True, conj='\'n'))