Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > braces fixed '#{' and '#}'

Reply
Thread Tools

braces fixed '#{' and '#}'

 
 
v4vijayakumar
Guest
Posts: n/a
 
      01-17-2009
I saw some code where someone is really managed to import braces from
__future__.

def test():
#{
print "hello"
#}
 
Reply With Quote
 
 
 
 
Roy Smith
Guest
Posts: n/a
 
      01-17-2009
In article
<(E-Mail Removed)>,
v4vijayakumar <(E-Mail Removed)> wrote:

> 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"
"""}"""
 
Reply With Quote
 
 
 
 
Steve Holden
Guest
Posts: n/a
 
      01-17-2009
Roy Smith wrote:
> In article
> <(E-Mail Removed)>,
> v4vijayakumar <(E-Mail Removed)> wrote:
>
>> 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"
> """}"""


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

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

 
Reply With Quote
 
Roy Smith
Guest
Posts: n/a
 
      01-17-2009
In article <(E-Mail Removed)>,
Steve Holden <(E-Mail Removed)> wrote:

> Roy Smith wrote:
> > In article
> > <(E-Mail Removed)>,
> > v4vijayakumar <(E-Mail Removed)> wrote:
> >
> >> 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"
> > """}"""

>
> Which would be OK if it were syntactically valid ...
>
> regards
> Steve


Doh. I'm sorry:

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

This one I tested
 
Reply With Quote
 
Martin P. Hellwig
Guest
Posts: n/a
 
      01-17-2009
Roy Smith wrote:
> In article <(E-Mail Removed)>,
> Steve Holden <(E-Mail Removed)> wrote:
>
>> Roy Smith wrote:
>>> In article
>>> <(E-Mail Removed)>,
>>> v4vijayakumar <(E-Mail Removed)> wrote:
>>>
>>>> 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"
>>> """}"""

>> Which would be OK if it were syntactically valid ...
>>
>> regards
>> Steve

>
> Doh. I'm sorry:
>
> def test():
> """{"""
> print "hello"
> """}"""
>
> This one I tested


print is deprecated use print()

--
mph
 
Reply With Quote
 
Brendan Miller
Guest
Posts: n/a
 
      01-18-2009
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.

On Sat, Jan 17, 2009 at 2:09 AM, v4vijayakumar
<(E-Mail Removed)> wrote:
> 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/pap...mbers_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"
 
Reply With Quote
 
Tim Roberts
Guest
Posts: n/a
 
      01-20-2009
"Brendan Miller" <(E-Mail Removed)> wrote:
>
>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...


--
Tim Roberts, http://www.velocityreviews.com/forums/(E-Mail Removed)
Providenza & Boekelheide, Inc.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
reifying indent and dedent into braces Rustom Mody Python 4 10-14-2009 12:13 AM
do loops and braces aidy Ruby 2 07-19-2006 02:12 PM
class_eval and braces Bertram Scharpf Ruby 1 01-27-2006 09:33 PM
brackets, braces and arrays bric ASP .Net 4 07-05-2004 06:07 PM
matching curly braces and regular expressions Dustin D. Perl 0 08-26-2003 11:18 PM



Advertisments