Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.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; 'subject:Python': 0.06; 'function,': 0.07; 'names.': 0.07; 'python': 0.08; 'difference,': 0.09; 'doc,': 0.09; 'tuple': 0.09; 'subject:error': 0.11; 'syntax': 0.11; 'package.': 0.12; 'wrote:': 0.15; 'library': 0.15; "'-'": 0.16; '+def': 0.16; '-def': 0.16; 'build.': 0.16; 'fix,': 0.16; 'fix:': 0.16; 'py3': 0.16; 're-written': 0.16; 'subject:syntax': 0.16; 'unpacking': 0.16; 'skip:" 40': 0.16; 'cc:addr:python-list': 0.16; 'pm,': 0.16; 'this:': 0.16; '>>>': 0.16; 'def': 0.16; 'errors,': 0.19; 'received:74.125.82.44': 0.19; 'received:mail-ww0-f44.google.com': 0.19; 'subject:question': 0.21; 'wrote': 0.21; 'variable': 0.21; '(most': 0.21; 'cc:2**0': 0.21; 'file,': 0.22; 'cc:no real name:2**0': 0.22; 'header:In- Reply-To:1': 0.22; 'trying': 0.23; 'responses.': 0.23; 'invalid': 0.25; 'traceback': 0.25; 'expect': 0.25; 'function': 0.26; 'tried': 0.27; 'message-id:@mail.gmail.com': 0.28; 'import': 0.29; "didn't": 0.29; 'cc:addr:python.org': 0.30; 'signatures': 0.30; 'sun,': 0.30; 'version': 0.30; 'least': 0.31; 'seem': 0.31; "i've": 0.33; 'does': 0.33; 'there': 0.34; '...': 0.34; 'e.g.': 0.34; "can't": 0.34; 'thank': 0.35; 'that,': 0.35; 'last):': 0.35; 'file': 0.36; 'skip:" 10': 0.36; 'explain': 0.36; 'doing': 0.37; 'received:google.com': 0.37; 'but': 0.37; 'some': 0.37; 'install': 0.38; 'something': 0.38; 'subject:: ': 0.38; 'hoping': 0.38; 'run': 0.39; 'received:74.125.82': 0.39; 'under': 0.39; 'received:74.125': 0.40; 'methods': 0.40; 'give': 0.60; 'your': 0.61; 'easily': 0.61; 'body': 0.63; 'removal': 0.64; '26,': 0.67; 'jun': 0.67; 'automatic': 0.73; 'python2': 0.84; 'revealing': 0.84; 'setting,': 0.84; 'unaware': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=QyNLdhvUH9sodXFzx4QGyTJZRI54WT/nheJrsNZbvmc=; b=vtjVUiL9Bm8JndEiCfJW3/BhCPgkbk5+kLmnLpyuOLtN2Ohs3s5aBmBbehIp2Dv/BQ wtlX5c4fmYabmGApVFRr7wcdC89Qpy3NDeifX4M6kCEbDAS61jC5+ZDQ/bVuM1kGUgiR N2z8eWvQuUn9vYRNmu5zpVr/auKpiSo6NDqgw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=FHR8LrICxEYrNH801NvBiq0jkjBNXoYx4RtOOdWi2CLZGXRIyitEAyAqCcR9L5Aw0B Gvpj0GLgATYuB57/IN7FXDRySHrZosE9T+63DL2YFWrvB3XaTbBiZxFFv0b8hG2tPwG5 KVJRKeTwIZhyK3j9B9SGGLcMi7IjX/cPeSfMQ= MIME-Version: 1.0 In-Reply-To: References: <4e074768$0$29982$c3e8da3$5496439d@news.astraweb.com> From: Noah Hall Date: Sun, 26 Jun 2011 16:32:27 +0100 Subject: Re: Python 3 syntax error question To: rzed Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 64 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1309102375 news.xs4all.nl 4366 [::ffff:82.94.164.166]:54787 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:8466 On Sun, Jun 26, 2011 at 4:28 PM, rzed wrote: > steve+comp.lang.python@pearwood.info wrote in > news:4e074768$0$29982$c3e8da3$5496439d@news.astraweb.com: > >> rzed wrote: >> >>> I've tried to install PySVG in a Python 3 setting, and I get a >>> few errors on the build. Most are easy to fix, but this one I >>> can't explain or fix: >>> >>> >>> Traceback (most recent call last): >>> =A0 File "", line 1, in >>> =A0 File "builders.py", line 12, in >>> =A0 =A0 from pysvg.shape import * >>> =A0 File "C:\Python32\lib\site-packages\pysvg\shape.py", line 91 >>> =A0 =A0 def moveToPoint(self,(x,y)): >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0^ >>> SyntaxError: invalid syntax >>> >> >> Function signatures with automatic tuple-unpacking are no longer >> allowed in Python3. So functions or methods like this: >> >> def moveToPoint(self,(x,y)): >> >> have to be re-written with the tuple unpacking moved into the >> body of the function, e.g. something like this: >> >> def moveToPoint(self, x_y): >> =A0 =A0 x, y =3D x_y >> >> >> Are you aware that you're trying to install a Python2 library >> under Python3? >> >> > > Thank you all for your responses. Yes, I am aware of the version > difference, but not of all the implications of that. I will run this > through 2to3, but even without doing that, there are only about four > syntax errors, and the others were obvious and easily corrected. > > There does not seem to be a Py3 version of this package. I was hoping > to try it to see what broke. Well, I found out at least part of that, > didn't I? > > I was not aware of the removal of tuple-unpacking. I expect there was > some extensive conversation about that. > > As to 2to3, I have to say that: > > -def a(b, (c,d)): > +def a(b, xxx_todo_changeme): > + =A0 =A0(c,d) =3D xxx_todo_changeme > > ... is not terribly revealing if one is unaware of what about it > needs changing. I know, I know: RTFM.... It means delete every line with a '-' and replace them with those next to the '+' Of course, if you read the doc, it'll give you lots of different options, including writing to the file, so all you need to do is change the variable names.