Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
40f1b2a2
Commit
40f1b2a2
authored
Sep 14, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extend test
Conflicts: tests/run/iterdict.pyx
parent
5d11b54e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
tests/run/iterdict.pyx
tests/run/iterdict.pyx
+50
-0
No files found.
tests/run/iterdict.pyx
View file @
40f1b2a2
...
@@ -505,3 +505,53 @@ def values_of_expression(**kwargs):
...
@@ -505,3 +505,53 @@ def values_of_expression(**kwargs):
"""
"""
# this can be optimised even in Py2
# this can be optimised even in Py2
return
[
arg
for
arg
in
dict
(
kwargs
.
items
()).
values
()
]
return
[
arg
for
arg
in
dict
(
kwargs
.
items
()).
values
()
]
def
items_of_expression
(
*
args
,
**
kwargs
):
"""
>>> sorted(items_of_expression(a=3, b=4))
[('a', 3), ('b', 4)]
>>> sorted(items_of_expression([('a', 3)], b=4))
[('a', 3), ('b', 4)]
"""
return
[
item
for
item
in
dict
(
*
args
,
**
kwargs
).
items
()]
def
iteritems_of_expression
(
*
args
,
**
kwargs
):
"""
>>> sorted(iteritems_of_expression(a=3, b=4))
[('a', 3), ('b', 4)]
>>> sorted(iteritems_of_expression([('a', 3)], b=4))
[('a', 3), ('b', 4)]
"""
return
[
item
for
item
in
dict
(
*
args
,
**
kwargs
).
iteritems
()]
def
for_in_items_of_expression
(
*
args
,
**
kwargs
):
"""
>>> sorted(for_in_items_of_expression(a=3, b=4))
[('a', 3), ('b', 4)]
>>> sorted(for_in_items_of_expression([('a', 3)], b=4))
[('a', 3), ('b', 4)]
"""
result
=
[]
for
k
,
v
in
dict
(
*
args
,
**
kwargs
).
items
():
result
.
append
((
k
,
v
))
return
result
def
for_in_iteritems_of_expression
(
*
args
,
**
kwargs
):
"""
>>> sorted(for_in_iteritems_of_expression(a=3, b=4))
[('a', 3), ('b', 4)]
>>> sorted(for_in_iteritems_of_expression([('a', 3)], b=4))
[('a', 3), ('b', 4)]
"""
result
=
[]
for
k
,
v
in
dict
(
*
args
,
**
kwargs
).
iteritems
():
result
.
append
((
k
,
v
))
return
result
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