I am working on a solo project and I find myself using very often the following:
list_obj = list(map(func, list_obj))
I want to just add the map functionality to the list class to avoid bloat and make it easier for me, so I created the class:
class list(list):
def map(self, func):
return type(self)(map(func, self))
This works fine when creating instances of lists using list(), but the issue is that instantiating a list using brackets [] or list comprehensions returns an instance of list with the old behavior. Is there a way to overload these instantiation methods?