oop - Python method that can be called on a list of objects -


when method called on object in python as:

obj.func() 

then python passes obj first argument func(). want like:

[obj1, obj2].func()  

and have processed as:

[obj1.func(), obj.func()] 

is there way of defining kind of methods in python?

the way you're asking subclass python build-in class list.

this should help.

ps: bad thing though.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -