[Python-checkins] python/nondist/peps pep-0290.txt,1.4,1.5

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Tue, 14 Jan 2003 17:55:14 -0800


Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1:/tmp/cvs-serv18660

Modified Files:
	pep-0290.txt 
Log Message:
Good modernization advice from Terry J. Reedy:
   Don't use list, dict, file, and such as variable names.



Index: pep-0290.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0290.txt,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** pep-0290.txt	30 Aug 2002 03:11:40 -0000	1.4
--- pep-0290.txt	15 Jan 2003 01:55:12 -0000	1.5
***************
*** 181,184 ****
--- 181,199 ----
  
  
+ Avoid Variable Names that Clash with the ``__builtins__`` Module
+ ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+ 
+ In Python 2.2, new built-in types were added for ``dict`` and ``file``.
+ Scripts should avoid assigning variable names that mask those types.
+ The same advice also applies to existing builtins like ``list``.
+ 
+ Pattern::
+ 
+     file = open('myfile.txt') --> f = open('myfile.txt')
+     dict = obj.__dict__ --> d = obj.__dict__
+ 
+ Locating:  ``grep 'file ' *.py``
+ 
+ 
  Python 2.1 or Later
  -------------------