Code blocks and top posting

Dave Benjamin ramen at lackingtalent.com
Sat Apr 10 12:31:58 EDT 2004


In article <8ef9bea6.0404100720.65ffd2c9 at posting.google.com>, Hung Jung Lu wrote:
> Dave Benjamin <ramen at lackingtalent.com> wrote in message news:<slrnc7fbrc.1ek.ramen at lackingtalent.com>...
>> 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. :



More information about the Python-list mailing list