Cheetah 2.2.1 introduced a new builtin 'file' to create file objects.
The old name 'open' has been retained for backward compatibility.
The problem is, it's been longstanding Python practice -- and arguably
more natural -- to use 'file' for a file name, and something else
(e.g., 'f') for a file object.
This won't affect ordinary Python programs because because the
local/global 'file' variable will override the builtin, and the old
'open' builtin will still work as expected. (At least for now. Who
knows when 'open' might start generating depreciation warnings or be
However, in Cheetah templates, placeholders can't override builtins.
If you've been using $file as a placeholder or CGI parameter, now it
will try to create a file object instead (and fail if you pass it
Tavis brought up the fact that the Template constructure has a file=
argument to specify the filename or file handle containing the
template definition. Shall we change this or leave it as is?
I personally would prefer to leave it and hope that PythonLabs doesn't
take away our open() function.
----- Forwarded message from Tavis Rudd <tavis@...> -----
From: Tavis Rudd <tavis@...>
Subject: Re: dummyTrans
Date: Sun, 21 Apr 2002 12:30:45 -0700
On April 21, 2002 12:09 pm, Mike Orr wrote:
> depreciated. But i've found my own programs look better with 'file'
> as the filename and 'open' as the constructor. Anyway, in Cheetah,
> if somebody has been using 'file' as a variable or CGI parameter,
> they'll find their template doesn't work right on Python 2.2.1.
> Future versions of Python will continue to have builtin changes
> unknowable now.
We should consider changing the name of the 'file' arg to Template()
----- End forwarded message -----
-Mike (Iron) Orr, iron@... (if mail problems: mso@...)
http://iron.cx/ English * Esperanto * Russkiy * Deutsch * Espan~ol