Talk:Python (programming language): Difference between revisions

Content deleted Content added
another alternative
Cyoung (talk | contribs)
Line 154:
 
:Note that I don't necessarily advocate this alternative, I just suggest it's one of our options. After the point that Fubar brought up, I think it's probably best to show two examples formatted according to best practice for the respective language, even if that causes confusion for the occasional reader who (sorry, anon) doesn't read the article to understand the difference that the examples demonstrate. -- [[User:Antaeus Feldspar|Antaeus Feldspar]] 17:04, 22 Sep 2004 (UTC)
 
::No apology necessary. I ''did'' read the article and understand the difference that the example demonstrated. My point was that the example did not make the article any clearer. This defeats the purpose of having an example. I still maintain it's a bad example until it clearly shows how C syntax is not influenced by whitespace and Python syntax is. I would suggest an example such as:
 
::;Example in C (poor indentation):
if (x == 0)
x = 100;
y = 100; /* Syntactically legal, but misleading indentation; y is assigned the value 100 regardless of the condition */
 
::;Example in C (good indendation, identical meaning as the above):
if (x == 0)
x = 100;
y = 100;
 
::;Example in Python
 
if x == 0:
x = 100
y = 100 # No confusion possible, y only assigned the value 100 if the x == 0 condition was true
 
::;Example in Python (different meaning due to indentation):
 
if x == 0:
x = 100
y = 100 # y is assigned regardless of the x == 0 condition outcome
 
::I realise that the above examples aren't worded particularly well, they're just intended to illustrate my point in this discussion. If I am alone on this then I gracefully admit my error in judgement. Kind regards, no longer anonymously [[User:Cyoung|Chris Young]] 04:37, 23 Sep 2004 (UTC)