summaryrefslogtreecommitdiff
path: root/modules/language/python/module/python.scm
diff options
context:
space:
mode:
authorStefan Israelsson Tampe <stefan.itampe@gmail.com>2018-03-27 16:19:00 +0200
committerStefan Israelsson Tampe <stefan.itampe@gmail.com>2018-03-27 16:19:00 +0200
commit944fc50b8b36455b9749ad6b60f3020d466f901c (patch)
treeabbbfdda0c84a10609a5ddda5d3940733db75f7e /modules/language/python/module/python.scm
parent1c4e6def8285e0740461b732c78c74ed3345f524 (diff)
large part of functools compiles
Diffstat (limited to 'modules/language/python/module/python.scm')
-rw-r--r--modules/language/python/module/python.scm13
1 files changed, 7 insertions, 6 deletions
diff --git a/modules/language/python/module/python.scm b/modules/language/python/module/python.scm
index 8cb47fb..2b1e368 100644
--- a/modules/language/python/module/python.scm
+++ b/modules/language/python/module/python.scm
@@ -25,6 +25,7 @@
#:use-module (language python range )
#:use-module (language python tuple )
#:use-module (language python eval )
+ #:use-module (language python bool )
#:replace (list abs min max hash round format)
@@ -33,7 +34,7 @@
IndexError KeyError AttributeError
send sendException next
GeneratorExit sendClose RuntimeError
- SyntaxError
+ SyntaxError bool
len dir next dict None property range
tuple bytes bytearray eval locals globals
compile exec type object
@@ -43,7 +44,7 @@
set all any bin callable reversed
chr classmethod staticmethod
divmod enumerate filter open
- getattr hasattr hex isinstance issubclass
+ getattr hasattr setattr hex isinstance issubclass
iter map sum id input oct ord pow super
sorted zip))
@@ -106,11 +107,14 @@
(define miss ((@ (guile) list) 'miss))
(define* (getattr a b #:optional (k miss))
- (let ((r (ref a (symbol->string b) k)))
+ (let ((r (ref a (if (string? b) (string->symbol b) b) k)))
(if (eq? r miss)
(raise AttributeError "object/class ~a is missing attribute ~a" a b)
r)))
+(define (setattr a k v)
+ (set a (if (string? k) (string->symbol k) k) v))
+
(define (hasattr a b)
(let ((r (ref a (symbol->string b) miss)))
(not (eq? r miss))))
@@ -296,9 +300,6 @@
(setvbuf port 'block buffering)))
port))
-
-
-