[Python-checkins] python/nondist/peps pep-0008.txt,1.14,1.15
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Tue, 04 Jun 2002 10:02:10 -0700
Update of /cvsroot/python/python/nondist/peps
In directory usw-pr-cvs1:/tmp/cvs-serv28278
Modified Files:
pep-0008.txt
Log Message:
Don't use 'strorunicodeobj' as the generic object name. Use just
'obj' -- after all, you don't know that it's a string or unicode
object just yet, that's what the test in these examples is for!
Index: pep-0008.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0008.txt,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** pep-0008.txt 4 Jun 2002 16:57:44 -0000 1.14
--- pep-0008.txt 4 Jun 2002 17:02:07 -0000 1.15
***************
*** 544,548 ****
have a common base class, basestring, so you can do:
! if isinstance(strorunicodeobj, basestring):
In Python 2.2, the types module has the StringTypes type defined
--- 544,548 ----
have a common base class, basestring, so you can do:
! if isinstance(obj, basestring):
In Python 2.2, the types module has the StringTypes type defined
***************
*** 550,560 ****
from string import StringTypes
! if isinstance(strorunicodeobj, StringTypes):
In Python 2.0 and 2.1, you should do:
from string import StringType, UnicodeType
! if isinstance(strorunicodeobj, StringType) or \
! isinstance(strorunicodeobj, UnicodeType) :
- For sequences, (strings, lists, tuples), use the fact that empty
--- 550,560 ----
from string import StringTypes
! if isinstance(obj, StringTypes):
In Python 2.0 and 2.1, you should do:
from string import StringType, UnicodeType
! if isinstance(obj, StringType) or \
! isinstance(obj, UnicodeType) :
- For sequences, (strings, lists, tuples), use the fact that empty