
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
A Python package for common list operations such as removing duplicates and flattening lists.
List Utilities
List Utilities is a simple Python package that provides utility functions for common list operations, including removing duplicates and flattening nested lists.
Installation
You can install the package using pip:
pip install list_utilities
Functions Descriptions
First Function: remove_duplicates(input_list) Description: This function takes a list as input and returns a new list that contains the unique elements from the original list, preserving their original order. It effectively removes any duplicate entries without altering the sequence of the remaining items.
Parameters: input_list (list): A list of elements from which duplicates need to be removed. The elements can be of any data type (e.g., integers, strings). Returns:
(list): A list containing only unique elements from the input_list.
Example:
from list_utilities import remove_duplicates
my_list = [1, 2, 2, 3, 4, 4, 5] unique_list = remove_duplicates(my_list) print(unique_list)
Output:
[1, 2, 3, 4, 5]
Second Function: flatten_list(nested_list) Description: This function flattens a nested list, which may contain other lists at any level of depth, into a single list. It recursively traverses through all elements and sub-elements, collecting them into a single flat structure.
Parameters:
nested_list (list): A list that may contain other lists as elements. The nesting can be at multiple levels. Returns:
(list): A single list that includes all elements from the nested_list, with no nesting. Example:
from list_utilities import flatten_list
nested = [[1, 2], [3, 4, [5, 6]], 7] flat = flatten_list(nested) print(flat)
Output:
[1, 2, 3, 4, 5, 6, 7]
License This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
A Python package for common list operations such as removing duplicates and flattening lists.
We found that list-utilities demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.