Ezio Melotti <ezio.melo...@gmail.com> added the comment:

> Be careful with whitespace changes.

Here I agree with you and disagree with the PEP 8 (specifically where it says 
that "hypot2 = x*x + y*y" and "c = (a+b) * (a-b)" are "wrong").

In
-   >>> 3+1j*3
+   >>> 3 + 1j * 3
I intentionally added spaces around all the operators to leave the expression 
ambiguous.  IIUC the point of that example is to show that even if 3+1j is a 
single entity, normal precedence rules still apply, so I didn't want the reader 
to make any assumptions about the precedence based on the whitespace (or even 
worse thing that the whitespace might define the precedence).

Additional comments and replies about the list:
 1) A user was confused about >>>, thought that was necessary to "define 
variables", that you had to always include it in your code.  The tutorial 
should make clear that this is used only in the interactive interpreter and not 
in regular code;
 2-3) what Eli said sounds good to me;
 5) "A value can be assigned to several variables simultaneously:" might lead 
to thing that "a = b = []" is the same as "a = []; b= []".  The term "variable" 
has a different meaning in other languages, but that doesn't mean we should 
refrain to use it -- we just have to specify what we mean with "variable" (this 
can be done later, saying that "both a and b will refer to the same list" 
should be enough here);
 6) here the idea is that is not the value to be assigned to the variable (like 
in C where the vars are like boxes and you can put values inside), but the 
variable that is used to refer to the object (so it's more like a label 
assigned to the object).  Again we can don't need to be too specific here yet, 
but we shouldn't say wrong things either.  See also 
http://python.net/crew/mwh/hacks/objectthink.html;
 11) presenting the error raised with the index first and the fact that slices 
are more "permissive" later sounds better to me;
 13) I'm not saying we should specifically tell users to put object of the same 
kind in a list, but just to avoid focusing on this aspect and use "realistic" 
examples.  Adding a note at the end saying that "lists can also contain objects 
of different types" should be enough;

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14097>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to