braces fixed '#{' and '#}'

V

v4vijayakumar

I saw some code where someone is really managed to import braces from
__future__. ;)

def test():
#{
print "hello"
#}
 
R

Roy Smith

v4vijayakumar said:
I saw some code where someone is really managed to import braces from
__future__. ;)

def test():
#{
print "hello"
#}

That usage is obsolete. Current best practice is:

def test():
"""{"""
print "hello"
"""}"""
 
S

Steve Holden

Roy said:
That usage is obsolete. Current best practice is:

def test():
"""{"""
print "hello"
"""}"""

Which would be OK if it were syntactically valid ...

regards
Steve
 
R

Roy Smith

Steve Holden said:
Which would be OK if it were syntactically valid ...

regards
Steve

Doh. I'm sorry:

def test():
"""{"""
print "hello"
"""}"""

This one I tested :)
 
B

Brendan Miller

Yes, I also recently noticed the bug in python's parser that doesn't
let it handle squigly braces and the bug in the lexer that makes white
space significant. I'm surprised the dev's haven't noticed this yet.

I saw some code where someone is really managed to import braces from
__future__. ;)

def test():
#{
print "hello"
#}

This seems like the best workaround. Hopefully python curly brace
support will be fixed soon. I think technically a language can't be
turing complete without curly braces right? That's definitely how I
read this:

http://www.thocp.net/biographies/papers/turing_oncomputablenumbers_1936.pdf

"If the negation of what Gödel has shown had been proved, i.e. if, for each U,
either U or –U is provable, then we should have an immediate solution of the
Entscheidungsproblem. As a corollary we also have that real
programmers use squigly braces and everyone else is nubs"
 
T

Tim Roberts

Brendan Miller said:
Yes, I also recently noticed the bug in python's parser that doesn't
let it handle squigly braces and the bug in the lexer that makes white
space significant. I'm surprised the dev's haven't noticed this yet.

It's very dangerous to make a post like this without including the smiley.
You're likely to get a mailbox full of "helpful" corrections...

;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top