[Python-ideas] Off topic: 'strike a balance' - second language English

Steve Barnes gadgetsteve at live.co.uk
Tue Aug 21 13:51:58 EDT 2018



On 21/08/2018 17:55, Jonathan Fine wrote:
> Nick Loadholtes wrote (elsewhere, quoted in this thread - by me).
> 
>> Make your docs work as hard as your code does. Clear examples will
>> make your code stand out in a good way.
> 
> With a bit more searching I found:
> <quote>
> https://www.reddit.com/r/Python/comments/70myto/whats_new_in_python_37_python_370a0_documentation/dn4v667/
> 
> I'll disagree. Nothing is better than Mathworks documentation. I like
> documentation by example.
> 
> Python gives you the dry, technically correct verbiage behind how
> something works.
> 
> Matlab says: "Here, copy paste this and it'll work".
> 
> To the point that the workspace is designed to automatically strip >>>
> from any copy and pasted commands.
> 
> Even with most Python examples you can't just copy and paste a chunk
> of an example from the web or documentation because you need to clean
> off >>> first.
> </quote>
> 
> It did me good, to read the resulting discussion on reddit.
> 

I would just like to point out that the ipython %paste magic very 
handily strips leading >, ... & + characters from the pasted block, 
(there is also some clever dedenting done).

So taking the example code:
 >>> def fn(param):
...     """ Print the param """
...     print(param)
...
 >>> fn(6)

on the clipboard and in ipython entering %paste results in:


In [2]: %paste
 >>> def fn(param):
...     """ Print the param """
...     print(param)
...
 >>> fn(6)

## -- End pasted text --
6

Which is ideal. I personally find that many beginners get on a lot 
better in the iPython console than in the python one.
-- 
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect 
those of my employer.

---
This email has been checked for viruses by AVG.
https://www.avg.com



More information about the Python-ideas mailing list