file_ref = open(string_ref)
Fernando Pérez
fperez528 at yahoo.com
Tue Apr 23 12:52:07 EDT 2002
Greg Weeks wrote:
> Is this code
>
> C1: file_ref = open(string_ref)
>
> better than this?:
>
> C2: file = open(string)
>
Definitely, but not for the reasons you state ;) Rather b/c with C2 you've
just obliterated the new file builtin (synonym to open) and the string module
name. So regardless of the IMHO needless distinction (in python, 'everything
is a name which points to an object') between objects and references, I'd use
C1 or something that doesn't use names of standard things like 'file' or
'string' for my own variables.
Cheers,
f.
More information about the Python-list
mailing list