[pypy-dev] New __builtin__
Scott Fenton
scott at fenton.baltimore.md.us
Mon Jan 27 01:24:06 CET 2003
On Mon, Jan 27, 2003 at 01:17:31AM +0100, holger krekel wrote:
> i tested your code with the Python-2.2.2 test_builtin.py
> (found in Python-2.2.2/Lib/test, has some dependencies).
>
> 1) your code does not import cleanly (some typos here
> and there)
>
> 2) the tests fail right at 'abs', the first builtin
> because you don't throw a TypeError if the argument
> is not a number.
>
> I take it that you didn't seriously intend your code
> to be used as is.
<sarcasm>Them thar's fightin' words, pardner</sarcasm>
>
> Nevertheless, it would be nice to have a python
> implementation of the builtin module that passes
> its CPython's tests. Also the docstrings should be
> copied from Python-2.3. This can be done automatically
> by writing a script and iterating over
> vars(__import__('__builtin__')) and using the inspect
> module. I hopefully can do this soon and check it into
> the upcoming repository. Or somebody else does it before
> me.
>
Don't worry. I'll take care of it. I just wanted to get
a rough sketch out first
> Note, that you cannot automize extraction
> of signatures of the builtin callables in all cases.
> C-implemented builtins don't have signature-introspection
> methods but often have a conventional (and quite parseable)
> description in the first line of the docstring, e.g.
>
> >>> print abs.__doc__
> abs(number) -> number
>
Or you do what I do and copy and paste them.
> cheers,
>
> holger
more cheers,
-Scott
--
char m[9999],*n[99],*r=m,*p=m+5000,**s=n,d,c;main(){for(read(0,r,4000);c=*r;
r++)c-']'||(d>1||(r=*p?*s:(--s,r)),!d||d--),c-'['||d++||(*++s=r),d||(*p+=c==
'+',*p-=c=='-',p+=c=='>',p-=c=='<',c-'.'||write(1,p,1),c-','||read(2,p,1));}
More information about the Pypy-dev
mailing list