Every line of 'a set can be appended to a set.' 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.
1597 def set_append(input_set, item): 1598 # type: (set, Any) -> set 1599 """ 1600 Appends in-place the given item to the set. 1601 If the item is a list, all elements are added to the set. 1602 1603 :param input_set: An existing set 1604 :param item: The item or list of items to add 1605 :return: The given set 1606 """ 1607 if item: 1608 if isinstance(item, (list, tuple)): 1609 input_set.update(item) 1610 else: 1611 input_set.add(item) 1612 return input_set