Re: List operation: Removing an item

2006-04-17 Thread Miguel E
Steven D'Aprano wrote: > On Sat, 15 Apr 2006 22:39:37 -0600, Miguel E. wrote: > > >>I am trying to create a function that removes an item as specified by >>the user. Apparently, the list operation "del list[:]" deletes the >>entire list. Below is the sample function. > > > If you know the value

Re: List operation: Removing an item

2006-04-16 Thread Terry Reedy
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sun, 16 Apr 2006 01:37:44 -0400, Terry Reedy wrote: >> Do you really need the items sorted? I strongly suspect that a set >> would >> work better. Much easier to randomly add, delete, and check membership. > > T

Re: List operation: Removing an item

2006-04-16 Thread Steven D'Aprano
On Sun, 16 Apr 2006 19:05:50 +0800, Fulvio wrote: > On Sunday 16 April 2006 13:37, Terry Reedy wrote: >>Do you really need the items sorted? > > Do you really think he isn't a troll? [scratches head] The OP looks like a beginner trying to experiment with Python as a way of learning how to progr

Re: List operation: Removing an item

2006-04-16 Thread Steven D'Aprano
On Sun, 16 Apr 2006 01:37:44 -0400, Terry Reedy wrote: > > "Miguel E." <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Hi, >> >> I've been (self) studying Python for the past two months and I have had >> no background in OOP whatsoever. >> >> I was able to write an interactive p

Re: List operation: Removing an item

2006-04-16 Thread Fulvio
On Sunday 16 April 2006 13:37, Terry Reedy wrote: >Do you really need the items sorted? Do you really think he isn't a troll? See the latest thread on lists end related PEP. However there's always some good info on your reply (all of those had reply to OP). F -- http://mail.python.org/mail

Re: List operation: Removing an item

2006-04-15 Thread Terry Reedy
"Miguel E." <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I've been (self) studying Python for the past two months and I have had > no background in OOP whatsoever. > > I was able to write an interactive program that randomly selects an item > from a list. From a Main Menu

Re: List operation: Removing an item

2006-04-15 Thread Steven D'Aprano
On Sat, 15 Apr 2006 22:39:37 -0600, Miguel E. wrote: > I am trying to create a function that removes an item as specified by > the user. Apparently, the list operation "del list[:]" deletes the > entire list. Below is the sample function. If you know the value of the item, and not its position: