list.without()?

Robert Vollmert rvollmert at gmx.net
Tue Nov 16 22:14:03 CET 1999


On Tue, Nov 16, 1999 at 09:28:07PM +0100, Christian Tismer wrote:
> Oh well, I overlooked that you have the try inside the while.
> That's bad. I thought I had read this:
> 
> def without( source, element):
>         temp = source[:]
>         try:
>                 while temp:
>                         temp.remove( element )
>         except:
>             return temp
>         return temp
> 
> Did you try this (I didn't, have no time).

Would it make a big difference if
  while temp:
were replaced by
  while 1:
?

-- 
Robert Vollmert                                      rvollmert at gmx.net




More information about the Python-list mailing list