Skip to content

Commit 7e7349f

Browse files
authored
Merge pull request #74 from braboj/5kydjt-codex/update-headers-in-python-examples
Clarify example headers
2 parents 030d6f9 + 1396bd1 commit 7e7349f

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

examples/07_functions/func_factory.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Function factories to create specialized functions
22
# -----------------------------------------------------------------------------
3-
# Shows how to use higher-order functions to generate customized functions.
3+
# This example uses higher-order functions to generate customized
4+
# functions.
45

56
def power_of(n):
67
def power(x):

examples/07_functions/func_lambda_bytecodes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# Example : Demonstrate that both lamda and def return the same result when compiled
1+
# Lambda and def produce the same bytecode
2+
# -----------------------------------------------------------------------------
3+
# This script compiles a lambda expression and a regular function to compare
4+
# their bytecode output.
5+
26
import dis
37

48
func1 = lambda x: x * x

examples/08_classes/class_variables.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# Example: Class attributes
1+
# Working with class attributes
2+
# -----------------------------------------------------------------------------
3+
# This script uses class-level variables that apply to every instance
4+
# of the Person class.
25

36
class Person(object):
47

@@ -11,7 +14,7 @@ def __init__(self, name, sex):
1114
self.sex = sex
1215

1316
def get_prefix(self):
14-
""" Demonstrate how to access class attributes from instance methods """
17+
"""Return the appropriate prefix using class attributes."""
1518

1619
# The person is male
1720
if self.sex == "male":

0 commit comments

Comments
 (0)