python needs leaning stuff from other language

Tim Wintle tim.wintle at teamrubber.com
Sat Apr 4 13:07:23 EDT 2009


On Sat, 2009-04-04 at 02:03 -0500, Robert Kern wrote:
> 
> Let's be clear: python-ideas seems positive on the idea of adding a .clear() 
> method. *Completely removing* slice assignment has not been broached there.

Yup, sorry - I did mean to refer to the initial suggestion, rather than
my comments

> 
> > (I didn't expect such strong responses btw!)
> 
> You are proposing the removal of a general, orthogonal feature (and breaking 
> code in consequence!) just because of a new syntax for a single special case of 
> that feature. That is quite simply ridiculous.

Ok, I may have come across a little strongly (was very tired) - I'm not
_actually_ saying we should remove it, I'm just pointing out why
adding .clear() to lists seems to be unnecessary and slightly messy. The
suggested removal of assignments to slices is a theoretical statement.

> 
> .clear() would be non-orthogonal syntactic sugar. That's okay! Python has 
> syntactic sugar in a number of other places, too! Appropriate doses of syntactic 
> sugar and non-orthogonality are precisely what lets you implement "There should 
> be one-- and preferably only one --obvious way to do it." The really key word in 
> that sentence is "obvious", not "one".
> 
> FWIW, removing slice assignment would be a gross form of non-orthogonality, too. 
> __getitem__, __setitem__ and __delitem__ should all be able to accept the same 
> indices (or else raise exceptions in the case of immutability).

hummm - I'm sure it would be confusing behaviour if it was not
available, but I'm not sure how it would be non-orthogonal




More information about the Python-list mailing list