Overwhelmed by the Simplicity of Python. Any Recommendation?
Terry Reedy
tjreedy at udel.edu
Fri Oct 12 14:41:02 EDT 2018
On 10/12/2018 1:06 PM, Chris Angelico wrote:
> There are many many different ways to write code, and you can approach
> your coding challenges from all sorts of directions. My recommendation
> is: Pseudo-code first, then implement in actual Python.
>
> https://en.wikipedia.org/wiki/Pseudocode
>
> Note how, in the Wiki page, there are a number of different forms of
> pseudocode. You're free to develop your own particular style. In
> general, pseudocode is a bit more rigorous than plain English, but
> less than actually-executable code.
Over two decades ago, I dubbed Python 'executable pseudocode'. I
recommend using it as such. Here is a common program template that
makes the basic logic clear
def f()
it = get_iterable()
<initialize other variables>
for item in it:
process(item)
return summary()
f(some args)
> Once you have some pseudocode
> written, make as few changes as you can, getting it to be runnable. In
> other words, you want your final code to look as much like pseudocode
> as you possibly can.
Either write the currently fake functions or replace the calls with
inline code. Do the latter for <pseudocode> items.
--
Terry Jan Reedy
More information about the Python-list
mailing list