Remarks to Python 2.3

Markus Schaber use-net at
Wed Sep 18 16:24:21 EDT 2002


I studied and was
very impressed - you manage to get python even more fascinating with
every release.

I especially like enumerate() and Bool.

But I have some remarks:

- Mutable sets support some in-place operations - should those, just as
the in place operations on lists, like sort(), return None instead of
the new list to make clear that they are in place operations and for the
sake of consistency?

- When replacing list elements using the extended slice syntax - e. G.
in a[::2] = range(0, -2, -1) - the left side must have exactly the same
numer of elements as the right side. So, to cite the example, a[::2] =
range(3) is illegal for a=[0, 1, -1, 3]. 

Now I could image that it makes sense to allow one single additional
element to be added to the list in case only the step is specified and
the operation doesn't produce a gap. So the given example above would be
valid, giving a sequence of five elements, whereas with a=[0, 1, 2] it
would stay illegal (as it would produce a gap). a[0:3:2]=range(3) would
stay illegal as it explicitly specifies the length of the range,
a[0:3:5]=range(3) could be allowed.


Schabi's Flohmarkt:

"XML combines all the inefficiency of text-based formats with most of
the unreadability of binary formats :-)" - Oren Tirosh

More information about the Python-list mailing list