Code blocks and top posting

D

Dave Benjamin

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
 
H

Hung Jung Lu

Dave Benjamin said:
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
 
D

Dave Benjamin

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()
 
J

Josiah Carlson

I understand your point, however...
... 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)
... ... funct()
... 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
 
J

Josiah Carlson

Clarification of my post necessary.
I understand your point, however...

... 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)
...
... funct()
...
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
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top