blob: 57690aa18dd3f364e367ca6b237837fcd5b753d6 (
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
25
26
27
28
29
30
31
32
33
|
(define-module (language python exceptions)
#:use-module (oop pf-objects)
#:use-module (oop goops)
#:export (StopIteration GeneratorExit RuntimeError
Exception))
(define-syntax-rule (aif it p x y) (let ((it p)) (if it x y)))
(define StopIteration 'StopIteration)
(define GeneratorExit 'GeneratorExit)
(define RuntimeError 'RuntimeError)
(define-python-class Exception ()
(define __init__
(case-lambda
((self)
(values))
((self str)
(set self 'str str))))
(define __repr__
(lambda (self . l)
(define port (if (pair? l) (car l) #f))
(aif it (ref self 'str)
(format port "~s: ~a"
(ref self '__name__) it)
(format port "~s"
(ref self '__name__))))))
|