Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46456

Re: Can anyone please help me in understanding the following python code

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <joshua.landau.ws@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; 'output': 0.05; 'interpreter.': 0.07; 'python3': 0.07; 'subject:code': 0.07; 'subject:help': 0.08; 'merging': 0.09; 'runs': 0.10; 'cc:addr :python-list': 0.11; 'python': 0.11; 'suggest': 0.14; '20]': 0.16; '55,': 0.16; 'brackets:': 0.16; 'complicated,': 0.16; 'python3.': 0.16; 'splitting': 0.16; 'subject:skip:u 10': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'obviously': 0.18; 'written': 0.21; 'cc:addr:python.org': 0.22; 'print': 0.22; '31,': 0.24; 'case.': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'subject:please': 0.30; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'prints': 0.31; 'though.': 0.31; 'probably': 0.32; 'running': 0.33; 'subject:the': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'so,': 0.37; 'how': 0.40; 'subject:Can': 0.60; 'more': 0.64; 'to:addr:gmail.com': 0.65; '26,': 0.68; 'therefore': 0.72; '2013': 0.98
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=ic1B8xSOERxK2vicidv3XreW5bdEnFEJahpdtRu7fow=; b=AdcpTpJl8uyTsObXMY9g13K3YdTtsSOa1kKLiDhP/2aug3jQLlMLT7adNDjRqYyN3Q J5nmXhp7mqhY771LHKTxqIMH3uSLf8OvZ6NaiBmdKNKyxKM9Aw/W5ULfi+wnz/cU2xuH zyk1EvLB89CHh626fPRC+GU4ZynKOuiTqCqmZ/OUD1ZbY2UJEljcSe/8WclkeKl7M/LZ UqtGN6Njf6wR3+YlLhu+GH9y2LToibP/gn46OVtlLaKhX2J8RynbSSIf1dXCGxxUhxUS Qk5fnjqIKml91Nbr4jKg6kddlq4F9p42sDR++HNEEVhg0H0ESTpoK08T1FyiOTTfnrYm +dfg==
X-Received by 10.152.19.65 with SMTP id c1mr3357173lae.24.1369912338423; Thu, 30 May 2013 04:12:18 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <fd037baa-b5b0-435e-b035-4e25b0d3acbd@googlegroups.com>
References <921173f3-21e7-46b4-a7b1-86660a3ebc72@googlegroups.com> <fd037baa-b5b0-435e-b035-4e25b0d3acbd@googlegroups.com>
From Joshua Landau <joshua.landau.ws@gmail.com>
Date Thu, 30 May 2013 12:11:38 +0100
Subject Re: Can anyone please help me in understanding the following python code
To bhk755@gmail.com
Content-Type text/plain; charset=UTF-8
Cc python-list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2404.1369912673.3114.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369912673 news.xs4all.nl 15910 [2001:888:2000:d::a6]:39491
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:46456

Show key headers only | View raw


On 30 May 2013 11:19,  <bhk755@gmail.com> wrote:
> Also, Can you please let me know how did you found out that I am using Python 2 Interpreter.

Do you have access to a Python3 interpreter? If so, try running it and
your output will look like:

Splitting  [54, 26, 93, 17, 77, 31, 44, 55, 20]
Splitting  [54, 26, 93, 17]
Splitting  [54, 26]
Splitting  [54]
Merging  [54]
Splitting  [26]
Merging  [26]
... BLAH BLAH BLAH

Which is obviously much nicer. This is how Chris knew the code was
written for Python3. Therefore I would suggest you use Python3 - not
all code runs on both!

The "proper" way to write the prints for Python2 is without the brackets:

print "Merging ",alist

But the methods Chris and I have used work the same on both so are
probably better in this case. They're more complicated, though.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Can anyone please help me in understanding the following python code bhk755@gmail.com - 2013-05-30 02:48 -0700
  Re: Can anyone please help me in understanding the following python code Chris Angelico <rosuav@gmail.com> - 2013-05-30 20:01 +1000
  Re: Can anyone please help me in understanding the following python code Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2013-05-30 10:17 +0000
  Re: Can anyone please help me in understanding the following python code bhk755@gmail.com - 2013-05-30 03:19 -0700
    Re: Can anyone please help me in understanding the following python	code Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2013-05-30 10:43 +0000
    Re: Can anyone please help me in understanding the following python code Chris Angelico <rosuav@gmail.com> - 2013-05-30 20:47 +1000
    Re: Can anyone please help me in understanding the following python code Joshua Landau <joshua.landau.ws@gmail.com> - 2013-05-30 12:11 +0100
  Re: Can anyone please help me in understanding the following python code Joshua Landau <joshua.landau.ws@gmail.com> - 2013-05-30 12:03 +0100
  Re: Can anyone please help me in understanding the following python code bhk755@gmail.com - 2013-05-30 05:39 -0700
    Re: Can anyone please help me in understanding the following python code bhk755@gmail.com - 2013-05-30 05:42 -0700
      Re: Can anyone please help me in understanding the following python code Dave Angel <davea@davea.name> - 2013-05-30 09:29 -0400
    Re: Can anyone please help me in understanding the following python code bhk755@gmail.com - 2013-05-30 05:42 -0700
    Re: Can anyone please help me in understanding the following python code Chris Angelico <rosuav@gmail.com> - 2013-05-30 22:55 +1000
  Re: Can anyone please help me in understanding the following python code bhk755@gmail.com - 2013-05-30 06:01 -0700
  Re: Can anyone please help me in understanding the following python code bhk755@gmail.com - 2013-05-30 21:53 -0700
  Re: Can anyone please help me in understanding the following python code bhk755@gmail.com - 2013-05-30 21:54 -0700
    Re: Can anyone please help me in understanding the following python code Cameron Simpson <cs@zip.com.au> - 2013-05-31 15:43 +1000
    Re: Can anyone please help me in understanding the following python code Chris Angelico <rosuav@gmail.com> - 2013-05-31 17:13 +1000
  Re: Can anyone please help me in understanding the following python code rusi <rustompmody@gmail.com> - 2013-06-01 10:43 -0700

csiph-web