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: 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: References: <921173f3-21e7-46b4-a7b1-86660a3ebc72@googlegroups.com> From: Joshua Landau 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 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On 30 May 2013 11:19, 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.