Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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; 'importerror:': 0.05; 'builtin': 0.07; 'correct,': 0.09; 'fixed,': 0.09; 'lawrence': 0.09; 'porting': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; '2.7': 0.13; 'cmp': 0.16; 'oct': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'sys.path': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'module': 0.19; 'skip:" 30': 0.20; 'suggested': 0.20; 'import': 0.21; 'thanks.': 0.21; '31,': 0.22; 'either.': 0.22; 'cheers,': 0.23; 'references': 0.23; "i've": 0.23; 'seems': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '(most': 0.27; 'functions.': 0.27; "doesn't": 0.28; 'header:X-Complaints-To:1': 0.28; "i'm": 0.29; 'becomes': 0.30; 'code': 0.31; 'file': 0.32; 'from:addr:yahoo.co.uk': 0.32; 'traceback': 0.33; 'to:addr:python- list': 0.33; 'skip:k 20': 0.35; 'pm,': 0.35; 'received:org': 0.36; 'busy': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'help': 0.40; 'blown': 0.84; 'received:89': 0.86 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: sort order for strings of digits Date: Thu, 01 Nov 2012 00:30:51 +0000 References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-89-240-161-14.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 In-Reply-To: X-Antivirus: avast! (VPS 121031-0, 31/10/2012), Outbound message X-Antivirus-Status: Clean 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: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351729868 news.xs4all.nl 6842 [2001:888:2000:d::a6]:50304 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32544 On 31/10/2012 22:24, Ian Kelly wrote: > On Wed, Oct 31, 2012 at 3:33 PM, Mark Lawrence wrote: > >> Nope. I'm busy porting my own code from 2.7 to 3.3 and cmp seems to be >> very dead. >> >> This doesn't help either. >> >> c:\Users\Mark\Cash\Python>**2to3.py >> >> Traceback (most recent call last): >> File "C:\Python33\Tools\Scripts\**2to3.py", line 3, in >> from lib2to3.main import main >> ImportError: No module named main >> > > Perhaps you have a sys.path conflict? Correct, now fixed, thanks. > > Use functools.cmp_to_key for porting cmp functions. "sort(x, my_cmp)" > becomes "sort(x, key=cmp_to_key(my_cmp))" > > The cmp builtin is also gone. If you need it, the suggested replacement > for "cmp(a, b)" is "(b < a) - (a < b)". As it's my own small code base I've blown away all references to cmp, it's rich comparisons all the way. > > Cheers, > Ian > -- Cheers. Mark Lawrence.