Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
9beeefbb
Commit
9beeefbb
authored
Jan 05, 2013
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup a few minor things.
parent
19cdee89
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
Doc/faq/design.rst
Doc/faq/design.rst
+3
-3
No files found.
Doc/faq/design.rst
View file @
9beeefbb
...
@@ -214,7 +214,7 @@ The major reason is history. Functions were used for those operations that were
...
@@ -214,7 +214,7 @@ The major reason is history. Functions were used for those operations that were
generic for a group of types and which were intended to work even for objects
generic for a group of types and which were intended to work even for objects
that didn't have methods at all (e.g. tuples). It is also convenient to have a
that didn't have methods at all (e.g. tuples). It is also convenient to have a
function that can readily be applied to an amorphous collection of objects when
function that can readily be applied to an amorphous collection of objects when
you use the functional features of Python (``map()``, ``
apply
()`` et al).
you use the functional features of Python (``map()``, ``
zip
()`` et al).
In fact, implementing ``len()``, ``max()``, ``min()`` as a built-in function is
In fact, implementing ``len()``, ``max()``, ``min()`` as a built-in function is
actually less code than implementing them as methods for each type. One can
actually less code than implementing them as methods for each type. One can
...
@@ -707,7 +707,7 @@ of each call to the function, and return the cached value if the same value is
...
@@ -707,7 +707,7 @@ of each call to the function, and return the cached value if the same value is
requested again. This is called "memoizing", and can be implemented like this::
requested again. This is called "memoizing", and can be implemented like this::
# Callers will never provide a third parameter for this function.
# Callers will never provide a third parameter for this function.
def expensive
(arg1, arg2, _cache={}):
def expensive(arg1, arg2, _cache={}):
if (arg1, arg2) in _cache:
if (arg1, arg2) in _cache:
return _cache[(arg1, arg2)]
return _cache[(arg1, arg2)]
...
@@ -732,7 +732,7 @@ languages. For example::
...
@@ -732,7 +732,7 @@ languages. For example::
try:
try:
...
...
if
(condition)
: raise label() # goto label
if
condition
: raise label() # goto label
...
...
except label: # where to goto
except label: # where to goto
pass
pass
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment