clear() method for lists
![](https://secure.gravatar.com/avatar/943c60e4b1686ea72a0dd48fd394dee4.jpg?s=120&d=mm&r=g)
In the list archives, this thread http://mail.python.org/pipermail/python-ideas/2009-April/003897.html discusses adding a clear() method to list objects, to complement those available for sets and dictionaries. Later in the thread: http://mail.python.org/pipermail/python-ideas/2009-April/003933.html Christian Heimes provided a patch to do it and R. H. commented that all it would take is Guido's blessing. So, I'm wondering, can we do this? What are the steps needed to ask this work to be blessed? -- Gerald Britton
![](https://secure.gravatar.com/avatar/047f2332cde3730f1ed661eebb0c5686.jpg?s=120&d=mm&r=g)
Sure. On Fri, Feb 5, 2010 at 11:39 AM, Gerald Britton <gerald.britton@gmail.com> wrote:
In the list archives, this thread
http://mail.python.org/pipermail/python-ideas/2009-April/003897.html
discusses adding a clear() method to list objects, to complement those available for sets and dictionaries. Later in the thread:
http://mail.python.org/pipermail/python-ideas/2009-April/003933.html
Christian Heimes provided a patch to do it and R. H. commented that all it would take is Guido's blessing.
So, I'm wondering, can we do this? What are the steps needed to ask this work to be blessed?
-- Gerald Britton _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
-- --Guido van Rossum (python.org/~guido)
![](https://secure.gravatar.com/avatar/943c60e4b1686ea72a0dd48fd394dee4.jpg?s=120&d=mm&r=g)
Wow! Fast! So, since I'm not a dev and don't know the ropes, what is the next step to get the method included? On Fri, Feb 5, 2010 at 3:26 PM, Guido van Rossum <guido@python.org> wrote:
Sure.
On Fri, Feb 5, 2010 at 11:39 AM, Gerald Britton <gerald.britton@gmail.com> wrote:
In the list archives, this thread
http://mail.python.org/pipermail/python-ideas/2009-April/003897.html
discusses adding a clear() method to list objects, to complement those available for sets and dictionaries. Later in the thread:
http://mail.python.org/pipermail/python-ideas/2009-April/003933.html
Christian Heimes provided a patch to do it and R. H. commented that all it would take is Guido's blessing.
So, I'm wondering, can we do this? What are the steps needed to ask this work to be blessed?
-- Gerald Britton _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
-- --Guido van Rossum (python.org/~guido)
-- Gerald Britton
![](https://secure.gravatar.com/avatar/047f2332cde3730f1ed661eebb0c5686.jpg?s=120&d=mm&r=g)
Ping Christian. :-) On Fri, Feb 5, 2010 at 12:32 PM, Gerald Britton <gerald.britton@gmail.com> wrote:
Wow! Fast! So, since I'm not a dev and don't know the ropes, what is the next step to get the method included?
On Fri, Feb 5, 2010 at 3:26 PM, Guido van Rossum <guido@python.org> wrote:
Sure.
On Fri, Feb 5, 2010 at 11:39 AM, Gerald Britton <gerald.britton@gmail.com> wrote:
In the list archives, this thread
http://mail.python.org/pipermail/python-ideas/2009-April/003897.html
discusses adding a clear() method to list objects, to complement those available for sets and dictionaries. Later in the thread:
http://mail.python.org/pipermail/python-ideas/2009-April/003933.html
Christian Heimes provided a patch to do it and R. H. commented that all it would take is Guido's blessing.
So, I'm wondering, can we do this? What are the steps needed to ask this work to be blessed?
-- Gerald Britton _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
-- --Guido van Rossum (python.org/~guido)
-- Gerald Britton
-- --Guido van Rossum (python.org/~guido)
![](https://secure.gravatar.com/avatar/60cac87fb9e2b5689242622999656cb0.jpg?s=120&d=mm&r=g)
ISTM, the language moratorium would preclude this change. Also, since it doesn't actually add any new functionality, it is more of a documentation issue, teaching basic python idioms: del s[:] or s[:] = [] Raymond On Feb 5, 2010, at 11:39 AM, Gerald Britton wrote:
In the list archives, this thread
http://mail.python.org/pipermail/python-ideas/2009-April/003897.html
discusses adding a clear() method to list objects, to complement those available for sets and dictionaries. Later in the thread:
http://mail.python.org/pipermail/python-ideas/2009-April/003933.html
Christian Heimes provided a patch to do it and R. H. commented that all it would take is Guido's blessing.
So, I'm wondering, can we do this? What are the steps needed to ask this work to be blessed?
-- Gerald Britton _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
![](https://secure.gravatar.com/avatar/047f2332cde3730f1ed661eebb0c5686.jpg?s=120&d=mm&r=g)
On Fri, Feb 5, 2010 at 1:09 PM, Raymond Hettinger <raymond.hettinger@gmail.com> wrote:
ISTM, the language moratorium would preclude this change.
Oops, you're right. Scratch the go-ahead. :-( While PEP 3003 allows case-by-case exemptions for adding methods to built-in objects, I think this isn't one of those cases, since the work-around sure is simple enough, and has been in the language for 20 years now. ;-)
Also, since it doesn't actually add any new functionality, it is more of a documentation issue, teaching basic python idioms:
del s[:] or s[:] = []
Though it's a common-enough special case that it shouldn't need slice manipulations, which are a bit of an acquired taste. I probably would have added this if I'd anticipated dict.clear(), which wasn't always part of the language. --Guido
Raymond
On Feb 5, 2010, at 11:39 AM, Gerald Britton wrote:
In the list archives, this thread
http://mail.python.org/pipermail/python-ideas/2009-April/003897.html
discusses adding a clear() method to list objects, to complement those available for sets and dictionaries. Later in the thread:
http://mail.python.org/pipermail/python-ideas/2009-April/003933.html
Christian Heimes provided a patch to do it and R. H. commented that all it would take is Guido's blessing.
So, I'm wondering, can we do this? What are the steps needed to ask this work to be blessed?
-- Gerald Britton _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
_______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
-- --Guido van Rossum (python.org/~guido)
![](https://secure.gravatar.com/avatar/943c60e4b1686ea72a0dd48fd394dee4.jpg?s=120&d=mm&r=g)
On Fri, Feb 5, 2010 at 4:16 PM, Guido van Rossum <guido@python.org> wrote:
On Fri, Feb 5, 2010 at 1:09 PM, Raymond Hettinger <raymond.hettinger@gmail.com> wrote:
ISTM, the language moratorium would preclude this change.
Oops, you're right. Scratch the go-ahead. :-(
So does this mean I should bring it up again for the next round?
While PEP 3003 allows case-by-case exemptions for adding methods to built-in objects, I think this isn't one of those cases, since the work-around sure is simple enough, and has been in the language for 20 years now. ;-)
Also, since it doesn't actually add any new functionality, it is more of a documentation issue, teaching basic python idioms:
del s[:] or s[:] = []
Though it's a common-enough special case that it shouldn't need slice manipulations, which are a bit of an acquired taste. I probably would have added this if I'd anticipated dict.clear(), which wasn't always part of the language.
--Guido
Raymond
On Feb 5, 2010, at 11:39 AM, Gerald Britton wrote:
In the list archives, this thread
http://mail.python.org/pipermail/python-ideas/2009-April/003897.html
discusses adding a clear() method to list objects, to complement those available for sets and dictionaries. Later in the thread:
http://mail.python.org/pipermail/python-ideas/2009-April/003933.html
Christian Heimes provided a patch to do it and R. H. commented that all it would take is Guido's blessing.
So, I'm wondering, can we do this? What are the steps needed to ask this work to be blessed?
-- Gerald Britton _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
_______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
-- --Guido van Rossum (python.org/~guido)
-- Gerald Britton
![](https://secure.gravatar.com/avatar/e8600d16ba667cc8d7f00ddc9f254340.jpg?s=120&d=mm&r=g)
On Fri, Feb 5, 2010 at 13:21, Gerald Britton <gerald.britton@gmail.com>wrote:
On Fri, Feb 5, 2010 at 4:16 PM, Guido van Rossum <guido@python.org> wrote:
On Fri, Feb 5, 2010 at 1:09 PM, Raymond Hettinger <raymond.hettinger@gmail.com> wrote:
ISTM, the language moratorium would preclude this change.
Oops, you're right. Scratch the go-ahead. :-(
So does this mean I should bring it up again for the next round?
Yep. Which reminds me, how do we want to handle ideas that come up during hte moratorium? Do we simply want to force them to be brought up again when 3.3 development opens up, or should we settle them now and require they have a PEP or bug marked for 3.3? The former risks a thundering herd of idea but it does make sure only serious ideas get brought up as someone has to remember to mention it again in at least a year. -Brett
While PEP 3003 allows case-by-case exemptions for adding methods to built-in objects, I think this isn't one of those cases, since the work-around sure is simple enough, and has been in the language for 20 years now. ;-)
Also, since it doesn't actually add any new functionality, it is more of a documentation issue, teaching basic python idioms:
del s[:] or s[:] = []
Though it's a common-enough special case that it shouldn't need slice manipulations, which are a bit of an acquired taste. I probably would have added this if I'd anticipated dict.clear(), which wasn't always part of the language.
--Guido
Raymond
On Feb 5, 2010, at 11:39 AM, Gerald Britton wrote:
In the list archives, this thread
http://mail.python.org/pipermail/python-ideas/2009-April/003897.html
discusses adding a clear() method to list objects, to complement those available for sets and dictionaries. Later in the thread:
http://mail.python.org/pipermail/python-ideas/2009-April/003933.html
Christian Heimes provided a patch to do it and R. H. commented that all it would take is Guido's blessing.
So, I'm wondering, can we do this? What are the steps needed to ask this work to be blessed?
-- Gerald Britton _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
_______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
-- --Guido van Rossum (python.org/~guido)
-- Gerald Britton _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
![](https://secure.gravatar.com/avatar/047f2332cde3730f1ed661eebb0c5686.jpg?s=120&d=mm&r=g)
On Fri, Feb 5, 2010 at 1:55 PM, Brett Cannon <brett@python.org> wrote:
Which reminds me, how do we want to handle ideas that come up during hte moratorium? Do we simply want to force them to be brought up again when 3.3 development opens up, or should we settle them now and require they have a PEP or bug marked for 3.3? The former risks a thundering herd of idea but it does make sure only serious ideas get brought up as someone has to remember to mention it again in at least a year.
I don't think we need to settle on a single process for this. If someone cares enough to write a PEP or file a bug let them do it. If they don't but remember when the moratorium ends, we can't stop them. I suppose a new tracker category for this would be fine to add. If someone actually goes through the efforts of writing a PEP falling in this category we can add a new PEP status too. -- --Guido van Rossum (python.org/~guido)
![](https://secure.gravatar.com/avatar/e8600d16ba667cc8d7f00ddc9f254340.jpg?s=120&d=mm&r=g)
On Fri, Feb 5, 2010 at 13:59, Guido van Rossum <guido@python.org> wrote:
On Fri, Feb 5, 2010 at 1:55 PM, Brett Cannon <brett@python.org> wrote:
Which reminds me, how do we want to handle ideas that come up during hte moratorium? Do we simply want to force them to be brought up again when 3.3 development opens up, or should we settle them now and require they have a PEP or bug marked for 3.3? The former risks a thundering herd of idea but it does make sure only serious ideas get brought up as someone has to remember to mention it again in at least a year.
I don't think we need to settle on a single process for this. If someone cares enough to write a PEP or file a bug let them do it. If they don't but remember when the moratorium ends, we can't stop them.
I suppose a new tracker category for this would be fine to add. If someone actually goes through the efforts of writing a PEP falling in this category we can add a new PEP status too.
For issues it's probably enough to either mark them against Python 3.3 or add a Moratorium keyword and simply not set their version in case the moratorium goes past 3.3. As for PEPs, we can mark their targeted version as 'Moratorium' or something. -Brett
![](https://secure.gravatar.com/avatar/2fc5b058e338d06a8d8f8cd0cfe48376.jpg?s=120&d=mm&r=g)
Am 05.02.2010 23:06, schrieb Brett Cannon:
On Fri, Feb 5, 2010 at 13:59, Guido van Rossum <guido@python.org <mailto:guido@python.org>> wrote:
On Fri, Feb 5, 2010 at 1:55 PM, Brett Cannon <brett@python.org <mailto:brett@python.org>> wrote: > Which reminds me, how do we want to handle ideas that come up during hte > moratorium? Do we simply want to force them to be brought up again when 3.3 > development opens up, or should we settle them now and require they have a > PEP or bug marked for 3.3? The former risks a thundering herd of idea but it > does make sure only serious ideas get brought up as someone has to remember > to mention it again in at least a year.
I don't think we need to settle on a single process for this. If someone cares enough to write a PEP or file a bug let them do it. If they don't but remember when the moratorium ends, we can't stop them.
I suppose a new tracker category for this would be fine to add. If someone actually goes through the efforts of writing a PEP falling in this category we can add a new PEP status too.
For issues it's probably enough to either mark them against Python 3.3 or add a Moratorium keyword and simply not set their version in case the moratorium goes past 3.3. As for PEPs, we can mark their targeted version as 'Moratorium' or something.
+1 -- I've created http://bugs.python.org/keyword10 for the eventuality. Georg -- Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out.
![](https://secure.gravatar.com/avatar/d6b9415353e04ffa6de5a8f3aaea0553.jpg?s=120&d=mm&r=g)
On 2/5/2010 4:55 PM, Brett Cannon wrote:
Which reminds me, how do we want to handle ideas that come up during hte moratorium? Do we simply want to force them to be brought up again when 3.3 development opens up, or should we settle them now and require they have a PEP or bug marked for 3.3?
It was already suggested/agreed that future versions (3.3, 3.4) be added to the tracker so that people add ticklers such as 'add xyx warning for 3.3'. This should be a feature request for 3.3.
![](https://secure.gravatar.com/avatar/764323a14e554c97ab74177e0bce51d4.jpg?s=120&d=mm&r=g)
On 2010-02-05 15:09 PM, Raymond Hettinger wrote:
ISTM, the language moratorium would preclude this change.
""" Case-by-Case Exemptions New methods on built-ins The case for adding a method to a built-in object can be made. """ -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
![](https://secure.gravatar.com/avatar/1f61c63c4a8c613367a9530e5994ef63.jpg?s=120&d=mm&r=g)
On Fri, Feb 5, 2010 at 1:39 PM, Gerald Britton <gerald.britton@gmail.com> wrote:
In the list archives, this thread discusses adding a clear() method to list objects, to complement those available for sets and dictionaries. Later in the thread: Christian Heimes provided a patch to do it and R. H. commented that all it would take is Guido's blessing.
So, I'm wondering, can we do this? What are the steps needed to ask this work to be blessed?
In the abstract it seems like such a method should be part of the Container ABC. Since the idea of a container would imply a method to clear its contents. mark
![](https://secure.gravatar.com/avatar/047f2332cde3730f1ed661eebb0c5686.jpg?s=120&d=mm&r=g)
On Sun, Feb 7, 2010 at 5:14 PM, average <dreamingforward@gmail.com> wrote:
On Fri, Feb 5, 2010 at 1:39 PM, Gerald Britton <gerald.britton@gmail.com> wrote:
In the list archives, this thread discusses adding a clear() method to list objects, to complement those available for sets and dictionaries. Later in the thread: Christian Heimes provided a patch to do it and R. H. commented that all it would take is Guido's blessing.
So, I'm wondering, can we do this? What are the steps needed to ask this work to be blessed?
In the abstract it seems like such a method should be part of the Container ABC. Since the idea of a container would imply a method to clear its contents.
Have you actually seen Python's Container ABC? -- --Guido van Rossum (python.org/~guido)
participants (9)
-
average
-
Brett Cannon
-
Christian Heimes
-
Georg Brandl
-
Gerald Britton
-
Guido van Rossum
-
Raymond Hettinger
-
Robert Kern
-
Terry Reedy