{ ml_flags int }
{ ml_doc c-string } ;
+STRUCT: PyPreConfig
+ { _config_init int }
+ { parse_argv int }
+ { isolated int }
+ { use_environment int }
+ { configure_locale int }
+ { coerce_c_locale int }
+ { coerce_c_locale_warn int }
+ ! { legacy_windows_fs_encoding int } ! on Windows
+ { utf8_mode int }
+ { dev_mode int }
+ { allocate int } ;
+
FUNCTION: PyObject* PyCFunction_NewEx ( PyMethodDef* ml,
PyObject* self,
PyObject* module )
+++ /dev/null
-USING: python.syntax ;
-IN: python.modules.__builtin__
-
-PY-FROM: __builtin__ =>
- callable ( obj -- ? )
- dir ( obj -- seq )
- int ( val -- s )
- len ( seq -- n )
- open ( name mode -- file )
- range ( n -- seq )
- repr ( obj -- str ) ;
-
-PY-METHODS: obj =>
- __name__ ( self -- n )
- __str__ ( o -- str ) ;
-
-PY-METHODS: file =>
- close ( self -- )
- fileno ( self -- n )
- tell ( self -- n ) ;
-
-PY-METHODS: str =>
- lower ( self -- self' )
- partition ( self sep -- bef sep aft )
- startswith ( self str -- ? )
- title ( self -- self' )
- zfill ( self n -- str' ) ;
-
-PY-METHODS: list =>
- append ( list obj -- )
- remove ( list obj -- ) ;
--- /dev/null
+USING: python.syntax ;
+IN: python.modules.builtins
+
+PY-FROM: builtins =>
+ callable ( obj -- ? )
+ dir ( obj -- seq )
+ int ( val -- s )
+ len ( seq -- n )
+ open ( name mode -- file )
+ range ( n -- seq )
+ repr ( obj -- str ) ;
+
+PY-METHODS: obj =>
+ __name__ ( self -- n )
+ __str__ ( o -- str ) ;
+
+PY-METHODS: file =>
+ close ( self -- )
+ fileno ( self -- n )
+ tell ( self -- n ) ;
+
+PY-METHODS: str =>
+ lower ( self -- self' )
+ partition ( self sep -- bef sep aft )
+ startswith ( self str -- ? )
+ title ( self -- self' )
+ zfill ( self n -- str' ) ;
+
+PY-METHODS: list =>
+ append ( list obj -- )
+ remove ( list obj -- ) ;
! None testing
{ t } [
- "__builtin__" py-import "None" getattr <none> =
+ "builtins" py-import "None" getattr <none> =
] py-test
! Pretty sure the # of None references should stay constant.
! Callbacks
: py-map ( -- alien )
- "__builtin__" py-import "map" getattr ;
+ "builtins" py-import "map" getattr ;
: py-map-call ( alien-cb -- seq )
[
USING: accessors arrays assocs continuations destructors destructors.private
fry io.files.temp kernel math namespaces python python.ffi
-python.modules.__builtin__ python.modules.argparse python.modules.datetime
+python.modules.builtins python.modules.argparse python.modules.datetime
python.modules.os python.modules.os.path python.modules.sys
python.modules.time python.objects python.syntax sets splitting tools.test
unicode ;
] py-test
! Make callbacks
-PY-QUALIFIED-FROM: __builtin__ =>
+PY-QUALIFIED-FROM: builtins =>
None ( -- )
map ( func seq -- seq' )
reduce ( func seq -- seq' ) ;
{ V{ 1 2 3 } } [
- __builtin__:$None { 1 2 3 } >py __builtin__:map py>
+ builtins:$None { 1 2 3 } >py builtins:map py>
] py-test
: double-fun ( -- alien )
{ V{ 2 4 16 2 4 68 } } [
double-fun [
- { 1 2 8 1 2 34 } >py __builtin__:map py>
+ { 1 2 8 1 2 34 } >py builtins:map py>
] with-quot>py-cfunction
] py-test
{ 48 } [
reduce-func [
- { 1 2 8 1 2 34 } >py __builtin__:reduce py>
+ { 1 2 8 1 2 34 } >py builtins:reduce py>
] with-quot>py-cfunction
] py-test
-USING: arrays kernel python python.ffi python.modules.__builtin__ python.syntax
-sequences ;
+USING: arrays kernel python python.ffi python.modules.builtins
+python.syntax sequences ;
IN: python.throwing
PY-FROM: traceback => format_tb ( tb -- seq ) ;