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
0c4d20bc
Commit
0c4d20bc
authored
Jul 05, 2018
by
Raymond Hettinger
Committed by
GitHub
Jul 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more detail to the Counter.fromkeys() comment block (GH-8124)
parent
3ae2e33a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
Lib/collections/__init__.py
Lib/collections/__init__.py
+7
-2
No files found.
Lib/collections/__init__.py
View file @
0c4d20bc
...
...
@@ -609,8 +609,13 @@ class Counter(dict):
@
classmethod
def
fromkeys
(
cls
,
iterable
,
v
=
None
):
# There is no equivalent method for counters because setting v=1
# means that no element can have a count greater than one.
# There is no equivalent method for counters because the semantics
# would be ambiguous in cases such as Counter('aaabbc', v=2).
# Initializing counters to zero values isn't necessary because zero
# is already the default value for counter lookups. Initializing
# to one is easily accomplished with Counter(set(iterable)). For
# more exotic cases, create a dictionary first using a dictionary
# comprehension or dict.fromkeys().
raise
NotImplementedError
(
'Counter.fromkeys() is undefined. Use Counter(iterable) instead.'
)
...
...
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