osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

My pseudocode to Python?


> Except 'list' is a bad name to use...

Definitely, it's not a good practice to use any reserved names, especially
built-in ones. A pretty common substitute I've seen is "ls", but it would
be preferable to have something more descriptive of the elements within the
list. But, for basic examples, "ls" should be fine.

On Mon, Aug 19, 2019 at 11:35 PM Alan Bawden <alan at csail.mit.edu> wrote:

> Alan Bawden <alan at csail.mit.edu> writes:
>
> > ram at zedat.fu-berlin.de (Stefan Ram) writes:
> > > for i in range( len( list )- 1, 0, -1 ):
> > >     if list[ i ]is None: del list[ i ]
> >
> > list = [x for x in list if x is not None]
>
> Except 'list' is a bad name to use...
>
> --
> Alan Bawden
> --
> https://mail.python.org/mailman/listinfo/python-list
>