[pypy-dev] __builtin__ module

Thomas Heller theller at python.net
Wed Jan 22 09:08:09 CET 2003

Scott Fenton <scott at fenton.baltimore.md.us> writes:

> Hello all. Due to the fact that there's no way
> in hell for me to get out of the US by March,
> and due to the fact that I love this concept,
> I've hacked up some basic replacements for
> various functions in __builtin__. The code 
> resides at http://fenton.baltimore.md.us/pypy.py
> Take a look at it and tell me what you think.

Your implementations of ord() and chr() are somewhat inefficient,
because they rebuild the list/dictionary each time.
Pass them to dis.dis() and you'll see what I mean.

Otherwise - cool.
> Currenty, this code implements everything BUT:
> * the exceptions (seperate concept)
> * builtin types (not sure how to handle them)
> * callable (not sure how to test)
> * classmethod (ditto)
> * coerce (tritto)
> * compile (needs an actual compiler, and the AST module scares me)
> * dir (not sure how to get current scope)
> * eval (not my job(TM))
> * execfile (ditto(TM))
> * hex, oct (lazyness, it'll be in version 2)
> * id (lower level than I can handle)
> * intern (didn't understand the docstring)
> * isinstance, issubclass (see classmethod)
> * globals, locals (not sure how to get ahold of them)
> * raw_input (really complex)
> * staticmethod (ugly hackery)
> * super (see classmethod)
> * type (need more info, dammit!)
> * unichr (given chr, unichr frightens me)
> * xrange (sorta builtin type)

Hm, it should be possible to find suitable tests in the
lib/test subdir, IMO.


More information about the Pypy-dev mailing list