Talk:Callback (computer programming): Difference between revisions

Content deleted Content added
m Task 70: Update syntaxhighlight tags - remove use of deprecated <source> tags
Line 161:
Please avoid using irrelevant concepts in the examples. For example, the python example on this page was,
 
<sourcesyntaxhighlight lang="pycon">
>>> def my_square(val):
... """ the callback """
Line 178:
3 ** 2 = 9
4 ** 2 = 16
</syntaxhighlight>
</source>
 
Why should we assume that the reader knows
Line 186:
 
I have since changed the above to:
<sourcesyntaxhighlight lang="pycon">
>>> def get_square(val):
... """ the callback """
Line 196:
>>> caller(get_square, 5)
25
</syntaxhighlight>
</source>
 
'''Caveat''': The example is complex because it demonstrates how callbacks can be implemented to achieve some complex behaviour; however, the program written to demonstrate this still should not include ''unnecessary'' concepts and be as simplistic as possible.