A bitbucket user complains that python 3.6.6 with -Wall -b prints warnings for 
some reportlab code; the
example boils down to the following

##########
C:\code\hg-repos\reportlab\tmp>cat tb.py
if __name__=='__main__':
    d={'a':1}
    d[b'a'] = d['a']
##########


C:\code\hg-repos\reportlab\tmp>\python36\python -Wall -b tb.py
tb.py:3: BytesWarning: Comparison between bytes and string
  d[b'a'] = d['a']

I had always assumed that dicts didn't care about the type of keys although some types might cause issue with hashability, but obviously the implementation seems to be comparing b'a' with 'a' (I suppose because they hash to the same chain).

Is this code erroneous or is the warning spurious or wrong?
--
Robin Becker

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to