4 examples of 'python list append multiple times' in Python

Every line of 'python list append multiple times' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
981def LIST_APPEND(f, *ignored):
982 w = f.popvalue()
983 v = f.popvalue()
984 f.space.call_method(v, 'append', w)

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

341def append_or_extend_list(lst, value):
342 if value is None:
343 return
344 elif isinstance(value, list):
345 lst.extend(value)
346 else:
347 lst.append(value)
368def append(self, value):
369 """Append value to the end.
371 Args:
372 value: Value to append
373 Raises:
374 ValueError: If value alread in self
375 TypeError: If value isn't hashable
376 """
377 self._append(value)
379def extend(self, values):
380 """Append all values to the end.
382 If any of the values are present, ValueError will
383 be raised and none of the values will be appended.
385 Args:
386 values (Iterable): Values to append
387 Raises:
388 ValueError: If any values are already present or there are duplicates
389 in the passed values.
390 TypeError: If any of the values aren't hashable.
391 """
392 self._extend(values)

Related snippets