Re: python needs leaning stuff from other language

2009-04-05 Thread Tim Wintle
On Sat, 2009-04-04 at 15:36 -0500, Robert Kern wrote: > On 2009-04-04 12:07, Tim Wintle wrote: > >>> (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 sin

Re: python needs leaning stuff from other language

2009-04-04 Thread Robert Kern
On 2009-04-04 12:07, Tim Wintle wrote: 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

Re: python needs leaning stuff from other language

2009-04-04 Thread Diez B. Roggisch
Tim Wintle schrieb: 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

Re: python needs leaning stuff from other language

2009-04-04 Thread Tim Wintle
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

Re: python needs leaning stuff from other language

2009-04-04 Thread Zamnedix
On Apr 3, 8:48 am, Steven D'Aprano wrote: > On Fri, 03 Apr 2009 08:23:22 -0700, Zamnedix wrote: > > On Apr 2, 3:25 pm, online.serv...@ymail.com wrote: > >> python's list needs a thing  list.clear()  like c# arraylist and > >> python needs a writeline() method > > > Please don't post things like li

Re: python needs leaning stuff from other language

2009-04-04 Thread Paul McGuire
On Apr 3, 11:48 pm, Tim Wintle wrote: > del mylist[:] > * or * > mylist[:] = [] > * or * > mylist = [] > > which, although semantically similar are different as far as the > interpreter are concerned (since two of them create a new list): > Only the last item creates a new list of any consequence

Re: python needs leaning stuff from other language

2009-04-04 Thread Giampaolo Rodola'
On 4 Apr, 04:19, Steven D'Aprano wrote: > On Fri, 03 Apr 2009 18:52:52 -0700, Giampaolo Rodola' wrote: > > If "there should be one-- and preferably only one --obvious way to do > > it" then my_list.clear() is more obvious than del my_list[:]. Honestly > > I'm a little surprised that such a topic h

Re: python needs leaning stuff from other language

2009-04-04 Thread Robert Kern
On 2009-04-03 23:48, Tim Wintle wrote: On Fri, 2009-04-03 at 18:27 -0500, Robert Kern wrote: agreed. If .clear was to be added then really assignments to slices should be entirely removed. Please tell me you are joking. Well I'm not joking as such. I've noticed that python-ideas seems to be

Re: python needs leaning stuff from other language

2009-04-03 Thread Tim Wintle
On Fri, 2009-04-03 at 18:27 -0500, Robert Kern wrote: > > agreed. If .clear was to be added then really assignments to slices > > should be entirely removed. > > Please tell me you are joking. Well I'm not joking as such. I've noticed that python-ideas seems to be positive on the idea, and has a

Re: python needs leaning stuff from other language

2009-04-03 Thread Steven D'Aprano
On Fri, 03 Apr 2009 18:52:52 -0700, Giampaolo Rodola' wrote: > If "there should be one-- and preferably only one --obvious way to do > it" then my_list.clear() is more obvious than del my_list[:]. Honestly > I'm a little surprised that such a topic hasn't been raised before. I'm a little surprise

Re: python needs leaning stuff from other language

2009-04-03 Thread Giampaolo Rodola'
If "there should be one-- and preferably only one --obvious way to do it" then my_list.clear() is more obvious than del my_list[:]. Honestly I'm a little surprised that such a topic hasn't been raised before. --- Giampaolo http://code.google.com/p/pyftpdlib -- http://mail.python.org/mailman/listi

Re: python needs leaning stuff from other language

2009-04-03 Thread Steven D'Aprano
On Fri, 03 Apr 2009 22:42:33 +0100, Tim Wintle wrote: > On Fri, 2009-04-03 at 13:12 -0400, Mel wrote: >> >>> I think it would also be better to have One (and prefereably Only >> >>> One) Obvious Way To Do It. That obvious way, for those who work >> >>> with Python's ‘set’ and ‘dict’, is a ‘clear’

Re: python needs leaning stuff from other language

2009-04-03 Thread Robert Kern
On 2009-04-03 16:42, Tim Wintle wrote: On Fri, 2009-04-03 at 13:12 -0400, Mel wrote: I think it would also be better to have One (and prefereably Only One) Obvious Way To Do It. That obvious way, for those who work with Python's ‘set’ and ‘dict’, is a ‘clear’ method. It seems best to have ‘list’

Re: python needs leaning stuff from other language

2009-04-03 Thread Ben Finney
Mel writes: > Well, if list.clear were truly and strictly to be the only way to > clear the contents of a list Who ever suggested that? Note that the “OOW” in OOWTDI does *not* mean “Only One Way”. It means “One Obvious Way”. Having other Ways To Do It is only mildly deprecated, not forbidden.

Re: python needs leaning stuff from other language

2009-04-03 Thread MRAB
Tim Wintle wrote: On Fri, 2009-04-03 at 13:12 -0400, Mel wrote: I think it would also be better to have One (and prefereably Only One) Obvious Way To Do It. That obvious way, for those who work with Python's ‘set’ and ‘dict’, is a ‘clear’ method. It seems best to have ‘list’ conform with this al

Re: python needs leaning stuff from other language

2009-04-03 Thread Tim Wintle
On Fri, 2009-04-03 at 13:12 -0400, Mel wrote: > >>> I think it would also be better to have One (and prefereably Only One) > >>> Obvious Way To Do It. That obvious way, for those who work with > >>> Python's ‘set’ and ‘dict’, is a ‘clear’ method. It seems best to have > >>> ‘list’ conform with this

Re: python needs leaning stuff from other language

2009-04-03 Thread Mel
Steven D'Aprano wrote: > On Fri, 03 Apr 2009 11:41:10 -0400, Mel wrote: > >> Ben Finney wrote: >> >>> I think it would also be better to have One (and prefereably Only One) >>> Obvious Way To Do It. That obvious way, for those who work with >>> Python's ‘set’ and ‘dict’, is a ‘clear’ method. It

Re: python needs leaning stuff from other language

2009-04-03 Thread Steven D'Aprano
On Fri, 03 Apr 2009 11:41:10 -0400, Mel wrote: > Ben Finney wrote: > >> I think it would also be better to have One (and prefereably Only One) >> Obvious Way To Do It. That obvious way, for those who work with >> Python's ‘set’ and ‘dict’, is a ‘clear’ method. It seems best to have >> ‘list’ conf

Re: python needs leaning stuff from other language

2009-04-03 Thread Steven D'Aprano
On Fri, 03 Apr 2009 08:23:22 -0700, Zamnedix wrote: > On Apr 2, 3:25 pm, online.serv...@ymail.com wrote: >> python's list needs a thing list.clear() like c# arraylist and >> python needs a writeline() method > > Please don't post things like list before you do any research. You don't > know wha

Re: python needs leaning stuff from other language

2009-04-03 Thread Mel
Ben Finney wrote: > I think it would also be better to have One (and prefereably Only One) > Obvious Way To Do It. That obvious way, for those who work with > Python's ‘set’ and ‘dict’, is a ‘clear’ method. It seems best to have > ‘list’ conform with this also. Does that mean a one-off special ca

Re: python needs leaning stuff from other language

2009-04-03 Thread Zamnedix
On Apr 2, 3:25 pm, online.serv...@ymail.com wrote: > python's list needs a thing list.clear() like c# arraylist > and > python needs a writeline() method Please don't post things like list before you do any research. You don't know what you are talking about. -- http://mail.python.org/mailman/li

Re: python needs leaning stuff from other language

2009-04-02 Thread Ben Finney
Steven D'Aprano writes: > The usual answer to that is that there's already two ways of clearing a > list: > > del alist[:] > alist[:] = [] > > and we don't need a third way. Dicts and sets need a clear() method, > because there's no equivalent to slicing. > > I still think that alist.clear()

Re: python needs leaning stuff from other language

2009-04-02 Thread Steven D'Aprano
On Thu, 02 Apr 2009 18:40:08 -0700, Zac Burns wrote: > Is it really worth it to not implement list.clear and answer this > question over and over again? > > I see no reason that a list shouldn't have a .clear method. The usual answer to that is that there's already two ways of clearing a list:

Re: python needs leaning stuff from other language

2009-04-02 Thread Rhodri James
On Fri, 03 Apr 2009 02:40:08 +0100, Zac Burns wrote: Is it really worth it to not implement list.clear and answer this question over and over again? For some value of "over and over again" that allows this to be the first time I've seen it several months of reading the newsgroup. I see no r

Re: python needs leaning stuff from other language

2009-04-02 Thread Armin
On Thursday 02 April 2009 22:40:08 Zac Burns wrote: > Is it really worth it to not implement list.clear and answer this > question over and over again? > > I see no reason that a list shouldn't have a .clear method. > > -- > Zachary Burns > (407)590-4814 > Aim - Zac256FL > Production Engineer (Digi

Re: python needs leaning stuff from other language

2009-04-02 Thread MRAB
Zac Burns wrote: Is it really worth it to not implement list.clear and answer this question over and over again? I see no reason that a list shouldn't have a .clear method. Does dict have a .clear method? Yes. Does set have a .clear method? Yes. Does list have a .clear method? No. Of course

Re: python needs leaning stuff from other language

2009-04-02 Thread Terry Reedy
Diez B. Roggisch wrote: online.serv...@ymail.com schrieb: python's list needs a thing list.clear() like c# arraylist and some_list[:] = [] Or del some_list[:] -- http://mail.python.org/mailman/listinfo/python-list

Re: python needs leaning stuff from other language

2009-04-02 Thread Zac Burns
Is it really worth it to not implement list.clear and answer this question over and over again? I see no reason that a list shouldn't have a .clear method. -- Zachary Burns (407)590-4814 Aim - Zac256FL Production Engineer (Digital Overlord) Zindagi Games On Thu, Apr 2, 2009 at 5:32 PM, Esmail

Re: python needs leaning stuff from other language

2009-04-02 Thread Esmail
Emile van Sebille wrote: Esmail wrote: Diez B. Roggisch wrote: online.serv...@ymail.com schrieb: python's list needs a thing list.clear() like c# arraylist and some_list[:] = [] I agree that this is nice and clear, but as a relative newbie wouldn't some_list = [] This is different --

Re: python needs leaning stuff from other language

2009-04-02 Thread Gary Herron
online.serv...@ymail.com wrote: python's list needs a thing list.clear() like c# arraylist and python needs a writeline() method -- http://mail.python.org/mailman/listinfo/python-list (While you are correct that Python needs these things, a better attitude, as a newbie, would be to *ask*

Re: python needs leaning stuff from other language

2009-04-02 Thread Emile van Sebille
Esmail wrote: Diez B. Roggisch wrote: online.serv...@ymail.com schrieb: python's list needs a thing list.clear() like c# arraylist and some_list[:] = [] I agree that this is nice and clear, but as a relative newbie wouldn't some_list = [] This is different -- it creates a new list. Co

Re: python needs leaning stuff from other language

2009-04-02 Thread Luis Alberto Zarrabeitia Gomez
Quoting Esmail : > Diez B. Roggisch wrote: > > > > some_list[:] = [] > > I agree that this is nice and clear, Not very intuitive, though, until you learn the syntax. (but, slice accessing and slice assignment are among the first few things one learns about python anyway, and once you learn it,

Re: python needs leaning stuff from other language

2009-04-02 Thread Luis Alberto Zarrabeitia Gomez
Quoting online.serv...@ymail.com: > python's list needs a thing list.clear() like c# arraylist It has: >>> l[:] = [] > python needs a writeline() method Now, that could be useful, a writeline method that knew the EOL convention for the OS and were not as deceiving as the current .writeline

Re: python needs leaning stuff from other language

2009-04-02 Thread Esmail
Diez B. Roggisch wrote: online.serv...@ymail.com schrieb: python's list needs a thing list.clear() like c# arraylist and some_list[:] = [] I agree that this is nice and clear, but as a relative newbie wouldn't some_list = [] be also acceptable (and pythonic?)? -- http://mail.python.org/

Re: python needs leaning stuff from other language

2009-04-02 Thread Diez B. Roggisch
online.serv...@ymail.com schrieb: python's list needs a thing list.clear() like c# arraylist and some_list[:] = [] python needs a writeline() method print() Diez -- http://mail.python.org/mailman/listinfo/python-list

python needs leaning stuff from other language

2009-04-02 Thread online . service
python's list needs a thing list.clear() like c# arraylist and python needs a writeline() method -- http://mail.python.org/mailman/listinfo/python-list