[pypy-dev] __builtin__ module

Christian Tismer tismer at tismer.com
Thu Jan 23 03:42:48 CET 2003


Thomas Heller wrote:
> 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.

This is correct for pure Python.
One would have computed the tables once and
either used them as a global, or as a default value
for a dummy function parameter.

On the other hand, with the assumption that Psyco or
its successor will be able to deduce constant local
expressions and turn them into constants, this
approach is absolutely fine; despite the fact that
these tables will most probably not be used and
replaced by their trivial implementation.

I anyway do appreciate the effort very much:
Trying to reduce stuff based upon a minimum!

cheers - chris



More information about the Pypy-dev mailing list