Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100801
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Andrew Farrell <armorsmith42@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: need some basic help |
| Date | Wed, 23 Dec 2015 21:58:40 -0600 |
| Lines | 37 |
| Message-ID | <mailman.104.1450965772.2237.python-list@python.org> (permalink) |
| References | <90cc0071-7c78-4974-88ad-60ff89649c95@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de jF1bLocMeNR+pC6b87is8A9IURXxX1g4UMbHgMU62qrg== |
| Return-Path | <armorsmith42@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'messages.': 0.04; 'msg': 0.07; 'subject:help': 0.07; 'cc:addr :python-list': 0.09; 'convention,': 0.09; 'objects.': 0.09; 'snippet': 0.09; 'python': 0.10; 'def': 0.13; 'wed,': 0.15; '23,': 0.16; 'msgs,': 0.16; 'msgs:': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'set)': 0.16; 'tuple,': 0.16; 'wrote:': 0.16; '"you': 0.18; 'subject:need': 0.18; 'tells': 0.18; 'email addr:gmail.com>': 0.18; 'foundation,': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; '(by': 0.22; 'seems': 0.23; 'chapter': 0.23; 'dec': 0.23; 'tutorials': 0.23; 'header:In- Reply-To:1': 0.24; 'least': 0.27; 'message-id:@mail.gmail.com': 0.27; 'subject:some': 0.29; 'objects': 0.29; 'url:mailman': 0.30; 'code': 0.30; 'class.': 0.30; 'probably': 0.31; 'skip:s 30': 0.31; 'maybe': 0.33; 'url:python': 0.33; 'url:listinfo': 0.34; 'case,': 0.34; 'list': 0.34; 'skip:& 20': 0.35; 'received:google.com': 0.35; 'so,': 0.35; 'question,': 0.35; "isn't": 0.35; 'list,': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'possible': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'two': 0.37; 'method': 0.37; 'thanks': 0.37; 'received:209': 0.38; 'someone': 0.38; 'goes': 0.39; 'does': 0.39; 'received:209.85.214': 0.39; 'takes': 0.39; 'url:mail': 0.40; 'called': 0.40; 'hello,': 0.40; 'some': 0.40; 'collection': 0.60; 'your': 0.60; 'skip:u 10': 0.61; 'below.': 0.66; 'chapter.': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=+UCzFZh9TIgjqsnkyH9hHxIFjOLsav1P7kH+mTAEEIc=; b=dtmg1XKX9veu6KVJX/zPVLa2FzPB+f0c70Wg8yFbNoptqwHMwjeMnFxL0jI6CJc+Dd L/W1uj+QN8MSmLtDIYOikIYoxmw2nYHe97cw5nh1gnIFQS0L9WSOJCA01nrFKh4hF/5T wUr5f3p+Tt4lu49fjaT5z4XZRG5tz+cktVwmIgBbmgia1XiUDa846+Us6Cx58cmizA62 ohHtX3zmVPKf6XMCM7ZEKzaz3qeOcbUXFYxkuG1U8CMXqOxrQFGQD/IAtW9AbtaM97Q0 HaMHKJOzD2KRol3/8CJOacUhTCG56t1rcSvAK8pLulV/8H7k7BrpYjaL623pvC10uYSs XiZQ== |
| X-Received | by 10.60.128.169 with SMTP id np9mr18177050oeb.79.1450929549822; Wed, 23 Dec 2015 19:59:09 -0800 (PST) |
| In-Reply-To | <90cc0071-7c78-4974-88ad-60ff89649c95@googlegroups.com> |
| X-Mailman-Approved-At | Thu, 24 Dec 2015 09:02:51 -0500 |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.20+ |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:100801 |
Show key headers only | View raw
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.ainy1@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 >
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
need some basic help Qurrat ul Ainy <qurratul.ainy1@gmail.com> - 2015-12-23 17:53 -0800
Re: need some basic help Benjamin Kulas <bkulbismuth@gmail.com> - 2015-12-23 20:24 -0800
Re: need some basic help Qurrat ul Ainy <qurratul.ainy1@gmail.com> - 2015-12-24 11:33 -0800
Re: need some basic help Qurrat ul Ainy <qurratul.ainy1@gmail.com> - 2015-12-24 11:38 -0800
Re: need some basic help Terry Reedy <tjreedy@udel.edu> - 2015-12-24 17:14 -0500
Re: need some basic help Steven D'Aprano <steve@pearwood.info> - 2015-12-24 22:58 +1100
Re: need some basic help Andrew Farrell <armorsmith42@gmail.com> - 2015-12-23 21:58 -0600
csiph-web