From fe9a0d123fe6ec15e2279298e0670ff064e962f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Sun, 26 Jun 2022 11:22:37 +0200 Subject: [PATCH] Inline --- README.md | 12 ++++++------ index.html | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index cd4e101..4e7f9e1 100644 --- a/README.md +++ b/README.md @@ -796,20 +796,20 @@ Inline ### Named Tuple, Enum, Dataclass ```python from collections import namedtuple -Point = namedtuple('Point', 'x y') # Tuple's subclass with named elements. -point = Point(0, 0) # Tuple with x and y attributes. +Point = namedtuple('Point', 'x y') # Creates a tuple's subclass. +point = Point(0, 0) # Returns its instance. ``` ```python from enum import Enum -Direction = Enum('Direction', 'n e s w') # Enum with n, e, s and w members. -direction = Direction.n # Member with name and value attributes. +Direction = Enum('Direction', 'n e s w') # Creates an enum. +direction = Direction.n # Returns its member. ``` ```python from dataclasses import make_dataclass -Player = make_dataclass('Player', ['loc', 'dir']) # Class with init, repr and eq methods. -player = Player(point, direction) # Object with loc and dir attributes. +Player = make_dataclass('Player', ['loc', 'dir']) # Creates a class. +player = Player(point, direction) # Returns its instance. ``` diff --git a/index.html b/index.html index 53a8553..6a01b81 100644 --- a/index.html +++ b/index.html @@ -680,17 +680,17 @@ func(*args, **kwargs) ['zero', 1, 2, 3]

Named Tuple, Enum, Dataclass

from collections import namedtuple
-Point = namedtuple('Point', 'x y')                  # Tuple's subclass with named elements.
-point = Point(0, 0)                                 # Tuple with x and y attributes.
+Point = namedtuple('Point', 'x y')                  # Creates a tuple's subclass.
+point = Point(0, 0)                                 # Returns its instance.
 
from enum import Enum
-Direction = Enum('Direction', 'n e s w')            # Enum with n, e, s and w members.
-direction = Direction.n                             # Member with name and value attributes.
+Direction = Enum('Direction', 'n e s w')            # Creates an enum.
+direction = Direction.n                             # Returns its member.
 
from dataclasses import make_dataclass
-Player = make_dataclass('Player', ['loc', 'dir'])   # Class with init, repr and eq methods.
-player = Player(point, direction)                   # Object with loc and dir attributes.
+Player = make_dataclass('Player', ['loc', 'dir'])   # Creates a class.
+player = Player(point, direction)                   # Returns its instance.
 

#Imports

import <module>            # Imports a built-in or '<module>.py'.
 import <package>           # Imports a built-in or '<package>/__init__.py'.