On Wed, May 1, 2013 at 1:58 AM, Dave Angel <da...@davea.name> wrote: > On 04/30/2013 11:49 AM, Chris Angelico wrote: >> >> On Wed, May 1, 2013 at 1:43 AM, Dave Angel <da...@davea.name> wrote: >>> >>> On 04/30/2013 11:27 AM, tro...@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 -- http://mail.python.org/mailman/listinfo/python-list