
On Fri, Mar 14, 2008 at 5:27 PM, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
Also, it enables making the file argument very abbreviated, e.g.
f = sys.stdout fprint(f, 'first line') fprint(f, 'another line here') fprint(f, 'and again')
Otherwise, the shortest you can get it down to is 'file=f', which is 6 times as long. It might not seem much, but that's 5 less characters of print arguments that you can fit in without having to split the line.
In that case I think partials a better option, when you could do: p = partial(print, file=sys.stderr) p('first line') p('another line here') p('and again') I completely forgot about partial which does a good job of filling in for what I wanted. I just need to consider the combination of the py3k stuff a bit more.