About 54 results
Open links in new tab
  1. What is the difference between Python's list methods append and …

    Oct 31, 2008 · Append has (amortized) constant time complexity, O (1). Extend has time complexity, O (k). Iterating through the multiple calls to .append() adds to the complexity, making it equivalent to …

  2. python - Concatenating two lists - difference between '+=' and extend ...

    ary.extend (ext) merely adds reference to "ext" list to the end of the "ary" list, resulting in less memory transactions. As a result, .extend works orders of magnitude faster and doesn't use any additional …

  3. python - Append vs extend efficiency - Stack Overflow

    As we can see, extend with list comprehension is still over two times faster than appending. Generator expressions appear noticeably slower than list comprehension. append_comp only introduces …

  4. Use of add(), append(), update() and extend() in Python

    Is there an article or forum discussion or something somewhere that explains why lists use append/extend, but sets and dicts use add/update? I frequently find myself converting lists into sets …

  5. python - Num list, qual é a diferença entre append e extend? - Stack ...

    Dec 9, 2016 · Num list em Python, existem os métodos append e extend. Qual é a diferença entre eles e quando devo usar cada um?

  6. python - В чем разница между extend и append? - Stack Overflow на …

    Jun 28, 2022 · В чем разница между extend и append? Вопрос задан 3 года 7 месяцев назад Изменён 3 года 7 месяцев назад Просмотрен 2k раза

  7. python - Extending list returns None - Stack Overflow

    May 2, 2015 · The function extend is an in-place function i.e. it will make the changes to the original list itself. From the docs Extend the list by appending all the items in the given list; equivalent to a [len …

  8. python - Can someone explain how .extend () works in depth for this ...

    Jul 8, 2019 · In any case, the answer here is simple, .extend is a method that works in-place on list objects, and will return None (which is generally true for mutator methods of Python built-in objects).

  9. Python "extend" for a dictionary - Stack Overflow

    Python "extend" for a dictionary Asked 16 years, 11 months ago Modified 3 years, 1 month ago Viewed 556k times

  10. why extend a python list - Stack Overflow

    Jan 8, 2012 · 1 You may extend() a python list with a non-list object as an iterator. An iterator is not storing any value, but an object to iterate once over some values. More on iterators here. In this …