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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
2799242d
Commit
2799242d
authored
Feb 01, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify some loops in the memoryview properties implementation
parent
c66d14f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
Cython/Utility/MemoryView.pyx
Cython/Utility/MemoryView.pyx
+4
-4
No files found.
Cython/Utility/MemoryView.pyx
View file @
2799242d
...
@@ -511,7 +511,7 @@ cdef class memoryview(object):
...
@@ -511,7 +511,7 @@ cdef class memoryview(object):
property
shape
:
property
shape
:
@
cname
(
'__pyx_memoryview_get_shape'
)
@
cname
(
'__pyx_memoryview_get_shape'
)
def
__get__
(
self
):
def
__get__
(
self
):
return
tuple
([
self
.
view
.
shape
[
i
]
for
i
in
xrange
(
self
.
view
.
ndim
)
])
return
tuple
([
length
for
length
in
self
.
view
.
shape
[:
self
.
view
.
ndim
]
])
property
strides
:
property
strides
:
@
cname
(
'__pyx_memoryview_get_strides'
)
@
cname
(
'__pyx_memoryview_get_strides'
)
...
@@ -520,7 +520,7 @@ cdef class memoryview(object):
...
@@ -520,7 +520,7 @@ cdef class memoryview(object):
# Note: we always ask for strides, so if this is not set it's a bug
# Note: we always ask for strides, so if this is not set it's a bug
raise
ValueError
(
"Buffer view does not expose strides"
)
raise
ValueError
(
"Buffer view does not expose strides"
)
return
tuple
([
s
elf
.
view
.
strides
[
i
]
for
i
in
xrange
(
self
.
view
.
ndim
)
])
return
tuple
([
s
tride
for
stride
in
self
.
view
.
strides
[:
self
.
view
.
ndim
]
])
property
suboffsets
:
property
suboffsets
:
@
cname
(
'__pyx_memoryview_get_suboffsets'
)
@
cname
(
'__pyx_memoryview_get_suboffsets'
)
...
@@ -528,7 +528,7 @@ cdef class memoryview(object):
...
@@ -528,7 +528,7 @@ cdef class memoryview(object):
if
self
.
view
.
suboffsets
==
NULL
:
if
self
.
view
.
suboffsets
==
NULL
:
return
[
-
1
]
*
self
.
view
.
ndim
return
[
-
1
]
*
self
.
view
.
ndim
return
tuple
([
s
elf
.
view
.
suboffsets
[
i
]
for
i
in
xrange
(
self
.
view
.
ndim
)
])
return
tuple
([
s
uboffset
for
suboffset
in
self
.
view
.
suboffsets
[:
self
.
view
.
ndim
]
])
property
ndim
:
property
ndim
:
@
cname
(
'__pyx_memoryview_get_ndim'
)
@
cname
(
'__pyx_memoryview_get_ndim'
)
...
@@ -551,7 +551,7 @@ cdef class memoryview(object):
...
@@ -551,7 +551,7 @@ cdef class memoryview(object):
if
self
.
_size
is
None
:
if
self
.
_size
is
None
:
result
=
1
result
=
1
for
length
in
self
.
shape
:
for
length
in
self
.
view
.
shape
[:
self
.
view
.
ndim
]
:
result
*=
length
result
*=
length
self
.
_size
=
result
self
.
_size
=
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