[ANN] Python 3 Cheat Sheet v2.0

Laurent Pointal laurent.pointal at free.fr
Sat Oct 31 12:20:22 EDT 2015


Le Sat, 31 Oct 2015 12:16:08 +1100, Steven D'Aprano a écrit :

> On Sat, 31 Oct 2015 06:56 am, Laurent Pointal wrote:
>>         https://perso.limsi.fr/pointal/python:memento
> 
> 
> Very nice! Thank you!
> 
> 
> Some small typos in the English version:


Thanks for your comments.

Q? Did you read version 1.2.2 or version 2.0 ?

Some typos propagate between versions (I fixed the "litteral"s), but I 
modified some parts (ex. for while loops the warning become "beware of 
infinite loops !" [I still have a space to remove before ! french/english 
typo differences]


> Some errors of fact:
> 
> Page 2, Generator of int sequences:
> 
> "range returns a «generator»"
> 
> This is not correct, `range` returns a lazy immutable sequence where the
> values are constructed as needed, not in advance.
> 
> https://docs.python.org/3/library/functions.html#func-range

Now (v2.0) range is presented as an integer sequence - without detail, 
dont know if beginners understand 'lasy' in our meaning.
 
> Page 2, Files:
> 
> "text file → read/write only strings, convert from/to required type"
> 
> While that is true for text files, it implies that open() always uses
> text files. This is not correct. You can open binary files too, and
> read/write raw bytes:
> 
> https://docs.python.org/3/library/functions.html#open
> https://docs.python.org/3/glossary.html#term-binary-file

Our students mainly work with text files, they have to convert all other 
values to str before writing. Its hard to be more complete within the 
remaining space. I'll see if I can add a small sentence about "text by 
default but can be binary with bytes content"

Thanks.
A+
Laurent.




More information about the Python-list mailing list