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

gcc - MinGW's ld cannot perform PE operations on non PE output file -

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

c# - Search and Add Comment with OpenXML for Word -