blob: 80b5c0651d780382c1bce55e1141cbe0bb902a09 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
(define-module (language python memoryview)
#:use-module (oop pf-objects)
#:use-module (language python exceptions)
#:use-module (language python try)
#:use-module ((language python module _python) #:select (isinstance bytes))
#:export (memoryview))
(define-python-class memoryview ()
(define __init__
(lambda (self obj)
(cond
((isinstance obj bytes)
(begin
(set self 'obj obj)
(set self 'format "B")
(set self 'ndim 1)))
(else
(raise (TypeError "not a supported memoryview object")))))))
|