Skip to content

Commit bad3b20

Browse files
committed
Refine script headers
1 parent a88b6a2 commit bad3b20

35 files changed

Lines changed: 107 additions & 34 deletions

examples/16_data_types/comprehension_dictionary.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Example dictionary comprehension
1+
# Dictionary comprehensions
2+
# -----------------------------------------------------------------------------
3+
# Dictionary comprehensions let you construct mappings concisely. They are ideal for transforming one form of data into key/value pairs.
24

35
existing_list = [1, 2, 3, 4, 5]
46
existing_dictionary = {1: "junior", 2: "mid", 3: "c", 4: "d", 5: "e"}

examples/16_data_types/comprehension_list.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Example list comprehension
1+
# List comprehensions
2+
# -----------------------------------------------------------------------------
3+
# List comprehensions allow you to create or filter lists concisely without explicit loops.
24

35
existing_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
46

examples/16_data_types/data_array.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Example: Array of data
1+
# Efficient arrays
2+
# -----------------------------------------------------------------------------
3+
# The array module stores numeric values more efficiently than lists because all elements share the same type.
24

35
import array
46

examples/16_data_types/data_base64.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Example: Base64 Encoding and Decoding
1+
# Base64 encoding
2+
# -----------------------------------------------------------------------------
3+
# Base64 converts binary data to ASCII text. This is handy when transmitting bytes over text-based protocols.
24

35
import base64
46

examples/16_data_types/data_binascii.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Example: binascii module
1+
# Binary-to-ASCII conversions
2+
# -----------------------------------------------------------------------------
3+
# The binascii module exposes low-level routines for converting between binary data and various ASCII encodings.
24

35

46
import binascii

examples/16_data_types/data_chainmap.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Example: ChainMap
1+
# Combining dictionaries with ChainMap
2+
# -----------------------------------------------------------------------------
3+
# ChainMap lets you combine several dictionaries into a single view without copying them.
24

35
from collections import ChainMap
46

examples/16_data_types/data_codecs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Example: codecs module
1+
# Encoding text with codecs
2+
# -----------------------------------------------------------------------------
3+
# The codecs module provides tools for encoding and decoding streams of text in different character sets.
24

35
import codecs
46
import pprint

examples/16_data_types/data_codecs_custom.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Example: Custom Codec
1+
# Custom codecs
2+
# -----------------------------------------------------------------------------
3+
# Registering a custom codec allows you to handle data stored in a specialized encoding.
24

35
import codecs
46

examples/16_data_types/data_copying.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Example: Data Copying
1+
# Deep and shallow copying
2+
# -----------------------------------------------------------------------------
3+
# Shallow and deep copying let you duplicate complex objects without affecting the originals.
24

35
import copy
46

examples/16_data_types/data_counter_class.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Example: Counter class
1+
# Counting with Counter
2+
# -----------------------------------------------------------------------------
3+
# A Counter is a dictionary subclass for tallying hashable objects quickly.
24

35
from collections import Counter
46

0 commit comments

Comments
 (0)