Kiwi PyCon 2016
Tai Chi Principles for Mindful Programmers
Dunedin, New Zealand
September 9-11, 2016
Barry Warsaw
Truth? What is truth? ... And by the way, if I always tell you the truth, you might start to believe me."
-- Michael
(as told by Victor Wooten in "The Music Lesson")
Washington DC, USA to Dunedin NZ

14000 km, 9000 miles, 25+ hours
Launchpad Epic

Launchpad Epic
2 week sprint, October 2008
- JavaScript / AJAX training
- Coding Dojos
- Transition to Python 2.5/2.6
- Ubuntu 8.10 release party
- Halloween!
BCTL

Taiji Quan
"Supreme Ultimate Boxing"
- Internal Chinese martial art
- Offensive/defensive
- Health
- Balance
- Reduce stress
- Mindfulness/awareness
- Qi
ondon
o
ome
arry
T
L
C
B
Yielding

Power

Collapse

Physical principles
Relax (but don't collapse)
Relax

Body upright

Flexible waist

Separate the weight

Fair Lady's Wrist

Cheng Man-Ch'ing

Do Without Doing
Demo
Title Text


#include <iostream>
using namespace std;
class XYZ {
public:
XYZ(int, int, int);
void set(int, int, int);
void print();
private:
int x, y, z;
};
XYZ::XYZ(int a, int b, int c) {
x = a;
y = b;
z = c;
}
void XYZ::set(int a, int b, int c) {
x = a;
y = b;
z = c;
}
void XYZ::print() {
cout << x << " " << y << " " << z << endl;
}
int main() {
XYZ xyz(3, 2, 1);
xyz.print();
xyz.set(9, 8, 7);
xyz.print();
return 0;
}

class XYZ:
def __init__(self, a, b, c):
self.x = a
self.y = b
self.z = c
def set(self, a, b, c):
self.x = a
self.y = b
self.z = c
def __repr__(self):
return '%s %s %s' % (self.x, self.y, self.z)
xyz = XYZ(3, 2, 1)
print(xyz)
xyz.set(9, 8, 7)
print(xyz)
with Lock():
look_ma_no_race_conditions()
@decorator
def function_to_augment(*args, **kws):
yield from other
[x.name for x in seq]
''.join(x.name for x in seq)
{x.name: x for x in seq}
async def http_get(domain):
Internationalization
- Translate full sentences
- Order of placeholders can change
What's in the way
is the Way
How do we know what to relax?
'%s is a member of %s' % (email, list_name)
Internationalization
'%(email)s is a member of %(list_name)s' % {
'email': email,
'list_name': list_name}
'%(list_name)s si a rebmem fo %(email)'
Oops!
What's "in the way"?
The odd
%(placeholder)s
format
PEP 292
from string import Template as _
def make_text(email, list_name):
text = _('$email is a member of $list_name')
return text.safe_substitute(email=email,
name=list_name)
Oops!
So much duplication
What's "the Way"?
Simplify
'$email is a member of $list_name'
Relax
==
def _(original_text, **extras):
translated = lookup(original_text)
frame = sys._getframe()
d = frame.f_globals.copy()
d.update(frame.f_locals)
d.update(extras)
return translated.safe_substitute(d)
from flufl.i18n import _
def make_text(email, list_name):
return _('$email is a member of $list_name')
Push hands

How do we learn to relax?
Sensing hands

Invest in Loss
Find the root cause
Toyota Lean Product Development

Launchpad sprint 2007
Launchpad defects
Root cause:
not enough code reviews
Experiment
On-call reviewer once/week
Team productivity

Branches landed/week
20% less productive
When is the right time to relax?
Listen
All musician's hear

Great musicians listen
Listening is awareness
Two minds, one connection

Be in the present moment
Do Without Doing
What's in the way is the Way
Invest in Loss
Listen
Tai Chi Principles
BREATHE
Thank You!
Barry Warsaw
barry@{python,list,debian}.org
barry@ubuntu.com
@pumpichank
github.com/warsaw
gitlab.com/warsaw
Kiwi Pycon 2016
By Barry Warsaw
Kiwi Pycon 2016
- 843