Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.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.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'syntax': 0.04; 'url:au': 0.05; 'debug': 0.07; 'convention,': 0.09; 'python:': 0.09; 'python': 0.11; '-------': 0.16; 'backslash': 0.16; 'escapes': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'octal': 0.16; 'overriding': 0.16; 'permissions,': 0.16; 'syntaxerror:': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '>>>': 0.22; 'code,': 0.22; '2.x': 0.24; 'source': 0.25; 'header:In-Reply- To:1': 0.27; 'chris': 0.29; 'leave': 0.29; 'am,': 0.29; 'unix': 0.29; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; 'decimal': 0.31; 'file': 0.32; 'supposed': 0.32; 'checking': 0.33; 'guess': 0.33; 'sense': 0.34; "i'd": 0.34; 'convert': 0.35; 'equal': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'are,': 0.36; 'done': 0.36; 'error.': 0.37; 'to:addr:python-list': 0.38; 'extremely': 0.39; 'url:2012': 0.39; 'url:12': 0.39; 'to:addr:python.org': 0.39; 'dave': 0.60; 'most': 0.60; 'course': 0.61; 'url:blogspot': 0.65; 'invalid': 0.68; 'actually,': 0.84; 'comment.': 0.84; 'surround': 0.84; 'angel': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=vpYPXDuylLbRVkAvNitTzP7Na1FuphYRoCjqMpE0r6M=; b=stY/6xsvLZoCmWwPirL0YL7/Nf3t7Lm4YPpHYNrRhzGKznKsvNqYrTOZ+dYrhNKIlh ask/E7T9xSwpUiZ3IJrqSLOdht4JGFasotxAi1Dmihs9l7TyLglESS4Bko6Nx4ZBRaNg 3xOQCdOrJhnj/mz8PoAcKVnf2I2M80E+pT1kpM6cwh7qGu0oj+Jjj/t3c0EqixoVFbbH Fwey4aTzeqOH/rRldreyD8ja5NkWYugjRRPoWmyUcpuQZgvMbvasSHcuOwXn3nh9Fu17 INGsdFdPr1RLgwk5yDhl2Zh6XagcNacMeIzZ7C91tUasaF88Y2mdRmQ8zzsoUZfyvP+D e64Q== MIME-Version: 1.0 X-Received: by 10.58.34.12 with SMTP id v12mr34701503vei.55.1367338003400; Tue, 30 Apr 2013 09:06:43 -0700 (PDT) In-Reply-To: <517FEA29.1010006@davea.name> References: <517FE68A.1000703@davea.name> <517FEA29.1010006@davea.name> Date: Wed, 1 May 2013 02:06:43 +1000 Subject: Re: shmid = shmget(SHM_KEY, SHM_SIZE, 0o666) - syntax error. 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: 45 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1367338005 news.xs4all.nl 15974 [2001:888:2000:d::a6]:37527 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44552 On Wed, May 1, 2013 at 1:58 AM, Dave Angel wrote: > On 04/30/2013 11:49 AM, Chris Angelico wrote: >> >> On Wed, May 1, 2013 at 1:43 AM, Dave Angel wrote: >>> >>> On 04/30/2013 11:27 AM, tromeo@mdlogix.com wrote: >>>> >>>> >>>> >>>> Please help me to debug >>>> >>>> ------- >>>> shmid = shmget(SHM_KEY, SHM_SIZE, 0o666) >>>> ^ >>>> SyntaxError: invalid syntax >>>> >>> >>> 0o666 is indeed a syntax error. What is that value supposed to be? If >>> it's >>> intended to be an int that's equal to octal 666, just use 438 >> >> >> Without checking docs, I would guess that to be Unix file permissions, >> which make most sense in octal. >> >> > > So put the octal description in the comment. I think the Python 2.x syntax > for octal is a travesty. And of course it's non-portable to Python 3. I > would not intentionally leave 0666 in my source code, unless there was some > other overriding reason for it. And then I'd surround it with snide > remarks. Here's a stupid way to convert octal to decimal in Python: >>> ord("\666") 438 Because backslash escapes in strings are, per convention, done in octal. :) And actually, on the extremely rare occasions when they're NOT octal, it's highly confusing. http://rosuav.blogspot.com.au/2012/12/i-want-my-octal.html ChrisA