Re: why no block comments in Python?

2006-03-08 Thread Warby
It's clear that if you have a modern editor, block comments are
unnecessary because it is trivial to add a # to the start of each line
of a block, but that doesn't really answer your question.  It explains
why you might not always need block comments but doesn't explain why
you shouldn't use them (especially in a primitive editor).

The danger with block comments is that there is no way to tell that the
code you're looking at has been commented out unless you can see the
start or end of the comment block.  If you have a modern editor, it
probably changes the color of all commented out code to eliminate
confusion.  But if you have a primitive editor it does not.  Also, even
people who use modern editors sometimes browse source code using a
plain text viewer (less/more).

Eliminating block comments eliminates uncertainty.  :)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: why no block comments in Python?

2006-03-08 Thread Warby
...and I forgot to mention that the output of grep and diff is far more
understandable in the absence of block comments!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: inserting into a list

2006-03-07 Thread Warby
It makes sense because a slice IS a list, so you should assign a list
to it.  Yours is just a special case in which the target slice has a
length of zero.  It's still a list, just an empty one:

 L = [1,2,4]
 print L[2:2]
[]

As for your question, yes:

 L = [1,2,4]
 L[2:2] = [[3]]
 print L
[1, 2, [3], 4]

Cheers! :)

-- 
http://mail.python.org/mailman/listinfo/python-list