[Tutor] Behavior of dictionary in mapping keys that evaluate equal

2016-05-11 Thread khalil zakaria Zemmoura
Hi, Suppose we have a dict Dic = { True: 'yes', 1: 'No'} According to the Python 3 documentation, the keys must have a unique value so True is converted to integer because of the type coercion (boolean are subtype of integer) so boolean are winded to integer to be compared. Am I missing somethin

Re: [Tutor] Behavior of dictionary in mapping keys that evaluate equal

2016-05-11 Thread cs
On 11May2016 14:00, khalil zakaria Zemmoura wrote: Suppose we have a dict Dic = { True: 'yes', 1: 'No'} According to the Python 3 documentation, the keys must have a unique value so True is converted to integer because of the type coercion (boolean are subtype of integer) so boolean are winded

Re: [Tutor] Behavior of dictionary in mapping keys that evaluate equal

2016-05-11 Thread Steven D'Aprano
On Wed, May 11, 2016 at 02:00:47PM +0100, khalil zakaria Zemmoura wrote: > Hi, > > Suppose we have a dict > Dic = { True: 'yes', 1: 'No'} > > According to the Python 3 documentation, the keys must have a unique value > so True is converted to integer because of the type coercion (boolean are > su

Re: [Tutor] Behavior of dictionary in mapping keys that evaluate equal

2016-05-11 Thread Peter Otten
Steven D'Aprano wrote: > On Wed, May 11, 2016 at 02:00:47PM +0100, khalil zakaria Zemmoura wrote: >> Hi, >> >> Suppose we have a dict >> Dic = { True: 'yes', 1: 'No'} >> >> According to the Python 3 documentation, the keys must have a unique >> value so True is converted to integer because of th