A good place to look at : <a href="http://www.norvig.com/sudoku.html">http://www.norvig.com/sudoku.html</a><br><br><div class="gmail_quote">On Mon, Apr 7, 2008 at 6:53 PM, Luke Paireepinart <<a href="mailto:rabidpoobear@gmail.com">rabidpoobear@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">W W wrote:<br>
> On 4/7/08, Luke Paireepinart <<a href="mailto:rabidpoobear@gmail.com">rabidpoobear@gmail.com</a>> wrote:<br>
><br>
>> W W wrote:<br>
>> What are you talking about? I don't understand what you mean by "ignores<br>
>> whitespace between dictionary elements."<br>
>><br>
>><br>
>>> foo = {'1a': 1, '1b':2, '1c':3,<br>
>>> '2a': 0, '2b': 9, '2c': 6}<br>
>>><br>
><br>
> Exactly that. If you were to write:<br>
><br>
> foo = {'1a': 1, '1b':2, '1c':3}<br>
> foo['2a'] = 0<br>
><br>
> You would get a nifty error.<br>
><br>
</div>You mean that the dictionary _definition_ ignores whitespace between<br>
elements?<br>
That's quite different than the dictionary itself ignoring whitespace.<br>
That implies that<br>
foo['1b'] is the same element as foo['1 b'], hence the source of my<br>
confusion.<br>
<br>
That's not a feature of dictionaries, but of the comma.<br>
You can easily do the following:<br>
x = [1, 2,<br>
3, 4]<br>
if you want.<br>
Same with tuples and various other things.<br>
Python just realizes that if it doesn't see a closing brace/bracket, but<br>
sees a comma, that more will probably be coming on the next line.<br>
You can do the same thing with backslash, if your statement does not end<br>
in a comma: for example,<br>
x = 1 + 1 + \<br>
2 + 3 + 5 \<br>
+ 8 + 13<br>
<br>
Also, did you test the code that "generates an error?"<br>
It works fine for me.<br>
>>> foo = {'1a': 'b'}<br>
>>> foo['2b'] = 0<br>
>>> print foo['2b']<br>
0<br>
>>><br>
<br>
Hope that helps,<br>
<font color="#888888">-Luke<br>
</font><div><div></div><div class="Wj3C7c">_______________________________________________<br>
Tutor maillist - <a href="mailto:Tutor@python.org">Tutor@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
</div></div></blockquote></div><br>