[issue33572] False/True as dictionary keys treated as integers

2018-05-18 Thread Janusz Harkot

New submission from Janusz Harkot :

using boolean (True/False) as dictionary keys, coerce them to integers - is 
this behavior documented somewhere?

I know that asking to fix this is not easy fix, but shouldn't this be 
highlighted everywhere with red flags and warnings, so people will know that 
this is expected?


Python 3.6.5 (default, Mar 29 2018, 03:28:50)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> dta = {False: 'false', True: 'true', 0: 'zero', 1: 'one'}
>>> print(dta[False])
zero
>>>

--
components: Interpreter Core
messages: 317032
nosy: Janusz Harkot
priority: normal
severity: normal
status: open
title: False/True as dictionary keys treated as integers
type: behavior
versions: Python 3.6

___
Python tracker 
<https://bugs.python.org/issue33572>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33572] False/True as dictionary keys treated as integers

2018-05-18 Thread Janusz Harkot

Janusz Harkot  added the comment:

Python 3.6.5 (default, Mar 29 2018, 03:28:50)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> dta = {False: 'false', True: 'true', 0: 'zero', 1: 'one'}
>>> print(dta[False])
zero
>>> dta
{False: 'zero', True: 'one'}
>>>

--

___
Python tracker 
<https://bugs.python.org/issue33572>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com