Code blocks and top posting

Discussion in 'Python' started by Dave Benjamin, Apr 10, 2004.

  1. def answer(question):
    return 'For pretty much the same reason top posting is.'

    if __name__ == '__main__':
    question = 'Why is Python not having code blocks annoying?'
    print answer(question)

    # HaHaOnlySerious

    --
    ..:[ dave benjamin: ramen/[sp00] -:- spoomusic.com -:- ramenfest.com ]:.
    : please talk to your son or daughter about parametric polymorphism. :
     
    Dave Benjamin, Apr 10, 2004
    #1
    1. Advertising

  2. Dave Benjamin

    Hung Jung Lu Guest

    Dave Benjamin <> wrote in message news:<>...
    > def answer(question):
    > return 'For pretty much the same reason top posting is.'
    >
    > if __name__ == '__main__':
    > question = 'Why is Python not having code blocks annoying?'
    > print answer(question)
    >
    > # HaHaOnlySerious


    def f(x):
    print x

    if __name__ == '__main__':
    f('Functions are annoying, by the same token?')

    Hung Jung
     
    Hung Jung Lu, Apr 10, 2004
    #2
    1. Advertising

  3. In article <>, Hung Jung Lu wrote:
    > Dave Benjamin <> wrote in message news:<>...
    >> def answer(question):
    >> return 'For pretty much the same reason top posting is.'
    >>
    >> if __name__ == '__main__':
    >> question = 'Why is Python not having code blocks annoying?'
    >> print answer(question)
    >>
    >> # HaHaOnlySerious

    >
    > def f(x):
    > print x
    >
    > if __name__ == '__main__':
    > f('Functions are annoying, by the same token?')


    for a_better_example in illustration_of_my_point:

    def you_now_see_why_they_are_there():
    print 'At this point, you lack sufficient context to'
    print 'understand why this function is necessary.'

    after(you_read_the_above_lines, you_now_see_why_they_are_there)

    # ie. by requiring the programmer to declare a named function before
    # passing a closure containing statements, you force the order of
    # declaration to be the reverse of the order of operation.

    after(supporting_codeblocks,
    [ you |
    you.dont_have_to_read_things_backwards_anymore()
    ])

    # Also, consider an asynchronous chain of events:

    def async_chain():

    def do_step_3():
    print 'Step 3.'

    def do_step_2():
    print 'Step 2'.
    after_idle(do_step_3)

    def do_step_1():
    print 'Step 1'.
    after_idle(do_step_2)

    # Do everything I said, but in the opposite order:
    after_idle(do_step_1)

    if only(we_could_find_a_nice_syntax_for_codeblocks):
    print 'We could again forward talking start.'

    # all in good fun,
    ramen()

    --
    ..:[ dave benjamin: ramen/[sp00] -:- spoomusic.com -:- ramenfest.com ]:.
    : please talk to your son or daughter about parametric polymorphism. :
     
    Dave Benjamin, Apr 10, 2004
    #3
  4. I understand your point, however...

    >>> def async_chain():

    ... def do_step_1():
    ... print 'Step 1.'
    ... after_idle(do_step_2)
    ... def do_step_2():
    ... print 'Step 2.'
    ... after_idle(do_step_3)
    ... def do_step_3():
    ... print 'Step 3.'
    ... after_idle(do_step_1)
    ...
    >>> def after_idle(funct):

    ... funct()
    ...
    >>> async_chain()

    Step 1.
    Step 2.
    Step 3.


    And what you seem to want...

    if condition:
    funct()

    def funct():
    #body

    .... is not available in any modern programming language. It is also not
    possible to handle syntactically in the Python interactive shell.

    - Josiah
     
    Josiah Carlson, Apr 10, 2004
    #4
  5. Clarification of my post necessary.

    > I understand your point, however...
    >
    > >>> def async_chain():

    > ... def do_step_1():
    > ... print 'Step 1.'
    > ... after_idle(do_step_2)
    > ... def do_step_2():
    > ... print 'Step 2.'
    > ... after_idle(do_step_3)
    > ... def do_step_3():
    > ... print 'Step 3.'
    > ... after_idle(do_step_1)
    > ...
    > >>> def after_idle(funct):

    > ... funct()
    > ...
    > >>> async_chain()

    > Step 1.
    > Step 2.
    > Step 3.


    I should clarify. The above works, but the below...

    > And what you seem to want...
    >
    > if condition:
    > funct()
    >
    > def funct():
    > #body
    >
    > .... is not available in any modern programming language. It is also
    > not possible to handle syntactically in the Python interactive shell.


    Is not available.

    - Josiah
     
    Josiah Carlson, Apr 10, 2004
    #5
    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. Arjen
    Replies:
    3
    Views:
    446
    Scott Allen
    Feb 27, 2005
  2. matt
    Replies:
    1
    Views:
    270
    George Ogata
    Aug 6, 2004
  3. Steven Taylor
    Replies:
    9
    Views:
    256
    Brian Candler
    Apr 27, 2009
  4. Anno Siegel

    Top level blocks and indentation

    Anno Siegel, Nov 22, 2003, in forum: Perl Misc
    Replies:
    6
    Views:
    121
    Anno Siegel
    Nov 23, 2003
  5. Larry Martell

    Top posting and double spacing

    Larry Martell, Feb 12, 2014, in forum: Python
    Replies:
    3
    Views:
    34
    Sivaram Neelakantan
    Feb 13, 2014
Loading...

Share This Page