braces fixed '#{' and '#}'

Discussion in 'Python' started by v4vijayakumar, Jan 17, 2009.

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

    def test():
    #{
    print "hello"
    #}
     
    v4vijayakumar, Jan 17, 2009
    #1
    1. Advertising

  2. v4vijayakumar

    Roy Smith Guest

    In article
    <>,
    v4vijayakumar <> 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"
    """}"""
     
    Roy Smith, Jan 17, 2009
    #2
    1. Advertising

  3. v4vijayakumar

    Steve Holden Guest

    Roy Smith wrote:
    > In article
    > <>,
    > v4vijayakumar <> 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/
     
    Steve Holden, Jan 17, 2009
    #3
  4. v4vijayakumar

    Roy Smith Guest

    In article <>,
    Steve Holden <> wrote:

    > Roy Smith wrote:
    > > In article
    > > <>,
    > > v4vijayakumar <> 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 :)
     
    Roy Smith, Jan 17, 2009
    #4
  5. Roy Smith wrote:
    > In article <>,
    > Steve Holden <> wrote:
    >
    >> Roy Smith wrote:
    >>> In article
    >>> <>,
    >>> v4vijayakumar <> 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
     
    Martin P. Hellwig, Jan 17, 2009
    #5
  6. 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
    <> 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/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"
     
    Brendan Miller, Jan 18, 2009
    #6
  7. v4vijayakumar

    Tim Roberts Guest

    "Brendan Miller" <> 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,
    Providenza & Boekelheide, Inc.
     
    Tim Roberts, Jan 20, 2009
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dustin D.
    Replies:
    0
    Views:
    2,327
    Dustin D.
    Aug 27, 2003
  2. bric

    brackets, braces and arrays

    bric, Jul 5, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    486
  3. johnp
    Replies:
    4
    Views:
    3,695
    Toby Inkster
    May 23, 2005
  4. Rustom Mody

    reifying indent and dedent into braces

    Rustom Mody, Oct 13, 2009, in forum: Python
    Replies:
    4
    Views:
    357
  5. Bertram Scharpf

    class_eval and braces

    Bertram Scharpf, Jan 27, 2006, in forum: Ruby
    Replies:
    1
    Views:
    112
    Eero Saynatkari
    Jan 27, 2006
Loading...

Share This Page