[Tutor] use of the newer dict types
Alan Gauld
alan.gauld at btinternet.com
Sat Jul 27 00:48:40 CEST 2013
On 26/07/13 22:55, Jim Mooney wrote:
>> bigBox = [ {1:2,3:4}, ['a',2,;freddy',True], (1,2,3) ]
>
> That is totally cool. I see something here every day that I know will
> be useful. Although Python choked on the semicolon in front of freddy.
Oops, my bad. It should, of course be a quote sign.
> And using True in place of 1 is sneakily pedagogical ;')
It's not 'in place of' 1, it is a totally different value and type.
It's only a happy coincidence that bool(1) returns True. So does
bool(-9) after all...
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list