Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98009 > unrolled thread

[ANN] Python 3 Cheat Sheet v2.0

Started byLaurent Pointal <laurent.pointal@free.fr>
First post2015-10-30 19:56 +0000
Last post2015-10-31 16:20 +0000
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  [ANN] Python 3 Cheat Sheet v2.0 Laurent Pointal <laurent.pointal@free.fr> - 2015-10-30 19:56 +0000
    Re: [ANN] Python 3 Cheat Sheet v2.0 Steven D'Aprano <steve@pearwood.info> - 2015-10-31 12:16 +1100
      Re: [ANN] Python 3 Cheat Sheet v2.0 Laurent Pointal <laurent.pointal@free.fr> - 2015-10-31 16:20 +0000

#98009 — [ANN] Python 3 Cheat Sheet v2.0

FromLaurent Pointal <laurent.pointal@free.fr>
Date2015-10-30 19:56 +0000
Subject[ANN] Python 3 Cheat Sheet v2.0
Message-ID<5633cb68$0$21247$426a74cc@news.free.fr>
Hello,

I just updated my one recto-verso sheet Python 3 Cheat Sheet

        https://perso.limsi.fr/pointal/python:memento

Many modifications and enhancements (bytes, literal ints, assignment 
complement, conversion tricks, cleaning sequences indexing, complement on 
boolean logic, modules import, exceptions, small organization charts for 
flow 
control, complement on list dict set methods, string methods, complment 
on 
files).

Still available in english and in french.

As the document become more dense, old version is kept online if prefered.

A+
L.Pointal.

[toc] | [next] | [standalone]


#98014

FromSteven D'Aprano <steve@pearwood.info>
Date2015-10-31 12:16 +1100
Message-ID<56341659$0$1587$c3e8da3$5496439d@news.astraweb.com>
In reply to#98009
On Sat, 31 Oct 2015 06:56 am, Laurent Pointal wrote:

> Hello,
> 
> I just updated my one recto-verso sheet Python 3 Cheat Sheet
> 
>         https://perso.limsi.fr/pointal/python:memento


Very nice! Thank you!


Some small typos in the English version:

Page 2, Conditional loop statement:

"☝ be careful of inifinite loops !"

Should be "infinite".
Remove space between "loops" and exclamation mark.


Page 2, Display/Input:

"items to display: litteral values, variables, expressions"

Should be "literal".


Page 2, Strings formatting:

"Conversion: s (readable text) or r (litteral representation)"

Should be "literal".



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


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




-- 
Steven

[toc] | [prev] | [next] | [standalone]


#98018

FromLaurent Pointal <laurent.pointal@free.fr>
Date2015-10-31 16:20 +0000
Message-ID<5634ea46$0$3195$426a74cc@news.free.fr>
In reply to#98014
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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web