"Canonical" way of deleting elements from lists - Python
This is a discussion on "Canonical" way of deleting elements from lists - Python ; Robert Latest <boblatest@yahoo.com> wrote:
> BTW, where can I find all methods of the built-in types?
>Section 3.6 only talks about strings and mentions the list append() method
>only in an example. Am I too stupid to read the manual, ...
-
Re: "Canonical" way of deleting elements from lists
Robert Latest <boblatest@yahoo.com> wrote:
> BTW, where can I find all methods of the built-in types?
>Section 3.6 only talks about strings and mentions the list append() method
>only in an example. Am I too stupid to read the manual, or is this an
>omission?
3.6 talks about features common to all "sequence" types. Strings
are discussed specifically in 3.6.1 ("String Methods"). Lists are
similarly discussed in 3.6.4 ("Mutable Sequence Types"). They are
certainly not omitted, although maybe the title of 3.6.4 could be
take a leaf from the Zen and be more explicit.
--
\S -- siona@chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
"Frankly I have no feelings towards penguins one way or the other"
-- Arthur C. Clarke
her nu becomež se bera eadward ofdun hlęddre heafdes bęce bump bump bump
-
Re: "Canonical" way of deleting elements from lists
Fredrik Lundh <fredrik@pythonware.com> wrote:
> Nick Craig-Wood wrote:
>
> > Using keywords[:] stops the creation of another temporary list.
>
> in CPython, "list[:] = iter" actually creates a temporary list object on
> the inside, in case "iter" isn't already a list or a tuple.
>
> (see the implementation of PySequence_Fast() for details).
Ah, OK, thanks for the correction!
--
Nick Craig-Wood <nick@craig-wood.com> -- http://www.craig-wood.com/nick
-
Re: "Canonical" way of deleting elements from lists
Sion Arrowsmith wrote:
> Robert Latest <boblatest@yahoo.com> wrote:
>> BTW, where can I find all methods of the built-in types?
>>Section 3.6 only talks about strings and mentions the list append() method
>>only in an example. Am I too stupid to read the manual, or is this an
>>omission?
>
> 3.6 talks about features common to all "sequence" types. Strings
> are discussed specifically in 3.6.1 ("String Methods"). Lists are
> similarly discussed in 3.6.4 ("Mutable Sequence Types").
OK, the latter then. Too stupid. Thanks ;-)
robert