This code snippet is a method on a class. What is a method? This chapter of the book Think Python <http://www.greenteapress.com/thinkpython/html/thinkpython018.html> does a good job of explaining it. Without understanding this foundation, it isn't possible to really answer your question, so definitely read at least that chapter. Think Python was the book I first learned from and if you are new to python, I recommend it among the other python tutorials to consider.
In this case, this method takes two things: 0) The object that it is a method of (by python convention, this is called "self") 1) a collection of message objects (probably a list, maybe a tuple, probably not a set) 2) a time It then, goes through all of them and tells each one "you were received at some particular time." by calling a method on each of the message objects. The object that it is a method of seems to have a list of messages it has received. So, this method sticks the collection of new message objects onto the list of already-received messages. On Wed, Dec 23, 2015 at 7:53 PM, Qurrat ul Ainy <qurratul.ai...@gmail.com> wrote: > Hello, > > Can someone please explain this code below. I am new at Python . > Thanks > > > def receive_messages(self, msgs, time): > for msg in msgs: > msg.set_recv_time(time) > self.msgs_received.extend(msgs) > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list