Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.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.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; "subject:' ": 0.07; 'subject:help': 0.08; 'subject:using': 0.09; 'def': 0.12; 'builtins': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject: \n ': 0.16; 'subject:python': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'header:In-Reply-To:1': 0.27; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; '25,': 0.31; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'good.': 0.35; 'received:google.com': 0.35; 'limitations': 0.36; 'received:209': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'skill': 0.68; 'carlos': 0.91; '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:date:message-id:subject:from:to :content-type; bh=YgQ2WqVnbqAlVlkmrxip3+/KP8AWqsez2a8CR7ObssQ=; b=ECjekLdUcgQ0DjZZf+a4M3tWe6QFASfIRHUMnNLv/43QUbl/Qmtev6HLOPGtTqBCrD ZR8wzZlRzErY3InCYwN+99gNYnRCP22SFPBJUq4xY/hGXm4ZTAB2b9rQCRbUIdZZUW1e wX7zAlmdDSJn4haUUMW5bwlUxwQhwy2H/OupeOSqzcjqOJjsgm4T7bHOrNfi4wDVi6xo l8VV3W/owcbXbRn7D6oaHtcLfirIN2YmtsBui9rJhJDBIZ0/3YqkDHWZxW/s94ArhKYC W16BnGc1AwWLL+gJpY+4Pab8/k6U+XpEuPrZJ9hF7vvlqzMfOlFvZ/AoVEqe9/WIcW8r Dcgg== MIME-Version: 1.0 X-Received: by 10.220.106.74 with SMTP id w10mr10803859vco.32.1369472469726; Sat, 25 May 2013 02:01:09 -0700 (PDT) In-Reply-To: References: <78192328-b31b-49d9-9cd6-ec742c092a29@googlegroups.com> <39ac7437-857e-483f-998c-8162c1039933@googlegroups.com> <51a052d1$0$6599$c3e8da3$5496439d@news.astraweb.com> <74e33270-a79a-4878-a400-8a6cda6637b2@googlegroups.com> Date: Sat, 25 May 2013 19:01:09 +1000 Subject: Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369472472 news.xs4all.nl 15925 [2001:888:2000:d::a6]:33860 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45980 On Sat, May 25, 2013 at 6:54 PM, Carlos Nepomuceno wrote: > lol > > def absolute(x): > return x if x>0 else -x > > def reach(x): > y=[] > z=0 > while z y.append(z) > z+=1 > return y Very good. You are now in a position to get past the limitations of a restricted-environment eval/exec. Avoiding builtins is actually a fun skill to hone. ChrisA