[Posted and e-mailed] With all due respect, you missed my way (Way 4): import sys def Set(a, b): a[0] = b return b a = [None] while Set(a, sys.stdin.readline()): print repr(a[0]) print "EOF:", repr(a[0]) I like it, I posted it elsewhere, but I guess it got lost in the noise or something. Moshe Zadka wrote: [Summary elided for brevity.]