From 013a0ad62bc55f2614cccf804c996e92ed1a8d8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Wed, 20 Jul 2022 20:59:58 +0200 Subject: [PATCH] Collection, Pickle, Image, Pygame --- README.md | 10 +++++----- index.html | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index a38526e..300302a 100644 --- a/README.md +++ b/README.md @@ -1242,7 +1242,7 @@ True ``` ### Collection -* **Only required methods are iter() and len().** +* **Only required methods are iter() and len(). Len() should return the number of items.** * **This cheatsheet actually means `''` when it uses `''`.** * **I chose not to use the name 'iterable' because it sounds scarier and more vague than 'collection'. The only drawback of this decision is that a reader could think a certain function doesn't accept iterators when it does, since iterators are the only built-in objects that are iterable but are not collections.** ```python @@ -1779,8 +1779,8 @@ Pickle ```python import pickle - = pickle.dumps() # Converts object to bytes. - = pickle.loads() # Converts bytes to object. + = pickle.dumps() # Converts object to bytes object. + = pickle.loads() # Converts bytes object to object. ``` ### Read Object from File @@ -2791,7 +2791,7 @@ from PIL import ImageDraw .line((x1, y1, x2, y2 [, ...])) .arc((x1, y1, x2, y2), from_deg, to_deg) .rectangle((x1, y1, x2, y2)) -.polygon((x1, y1, x2, y2 [, ...])) +.polygon((x1, y1, x2, y2, ...)) .ellipse((x1, y1, x2, y2)) ``` * **Use `'fill='` to set the primary color.** @@ -3000,7 +3000,7 @@ while all(event.type != pg.QUIT for event in pg.event.get()): ```python from pygame.transform import scale, ... = scale(, (width, height)) # Returns scaled surface. - = rotate(, degrees) # Returns rotated and scaled surface. + = rotate(, anticlock_degrees) # Returns rotated and scaled surface. = flip(, x_bool, y_bool) # Returns flipped surface. ``` diff --git a/index.html b/index.html index 66bd42a..3e792ad 100644 --- a/index.html +++ b/index.html @@ -1061,7 +1061,7 @@ Hello World! True

Collection

    -
  • Only required methods are iter() and len().
  • +
  • Only required methods are iter() and len(). Len() should return the number of items.
  • This cheatsheet actually means '<iterable>' when it uses '<collection>'.
  • I chose not to use the name 'iterable' because it sounds scarier and more vague than 'collection'. The only drawback of this decision is that a reader could think a certain function doesn't accept iterators when it does, since iterators are the only built-in objects that are iterable but are not collections.
class MyCollection:
@@ -1486,8 +1486,8 @@ CompletedProcess(args=['bc', #Pickle

Binary file format for storing Python objects.

import pickle
-<bytes>  = pickle.dumps(<object>)  # Converts object to bytes.
-<object> = pickle.loads(<bytes>)   # Converts bytes to object.
+<bytes>  = pickle.dumps(<object>)  # Converts object to bytes object.
+<object> = pickle.loads(<bytes>)   # Converts bytes object to object.
 
@@ -2277,7 +2277,7 @@ img.convert('RGB').save(240, 2
from pygame.transform import scale, ...
 <Surf> = scale(<Surf>, (width, height))         # Returns scaled surface.
-<Surf> = rotate(<Surf>, degrees)                # Returns rotated and scaled surface.
+<Surf> = rotate(<Surf>, anticlock_degrees)      # Returns rotated and scaled surface.
 <Surf> = flip(<Surf>, x_bool, y_bool)           # Returns flipped surface.
 
from pygame.draw import line, ...