On Tue, Oct 17, 2017 at 3:07 AM, bartc <b...@freeuk.com> wrote: > On 16/10/2017 16:58, Stefan Ram wrote: >> >> Xue Feng <xf.lo...@yahoo.com> writes: >>> >>> I wonder why 'del' is not a function or method. >> >> >> Assume, >> >> x = 2. >> >> When a function »f« is called with the argument »x«, >> this is written as >> >> f( x ) >> >> . The function never gets to see the name »x«, just >> its boundee (value) »2«. So, it cannot delete the >> name »x«. >> >> Also, the function has no access to the scope of »x«, >> and even more so, it cannot make any changes in it. >> >> Therefore, even a call such as >> >> f( 'x' ) >> >> will not help much. > > > What about del team[2]? > > There is no name involved here, and even a reference to team[2] won't help. > > Presumably there is no other way to do an in-place deletion of an element of > a list. (Inserting an element is different.)
team.pop(2) will in-place delete one element. So you have both options. ChrisA -- https://mail.python.org/mailman/listinfo/python-list