[Python-3000] BytesWarning for str != bytes
Georg Brandl
g.brandl at gmx.net
Sat Jun 7 17:04:59 CEST 2008
Hi,
python -b warns when you do "a" == b"a". However, it doesn't warn when
you do "a" != b"a" which occurs not as frequently, but is usually also a
sign of a bug.
See the aifc.py module:
def initfp(self, file):
...
self._file = Chunk(file)
if self._file.getname() != 'FORM':
raise Error('file does not start with FORM id')
Where getname() returns a bytes object. Wouldn't it make sense to have
!= issue the same warning as ==?
Georg
--
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.
More information about the Python-3000
mailing list