[pypy-dev] Can someone review my RPython code?

Timothy Baldridge tbaldridge at gmail.com
Sat May 26 22:19:38 CEST 2012


So here's the current status of my Polymorphic functions in as a pypy module:

https://bitbucket.org/halgari/pypy/src/d9e7191d13df/pypy/module/clojure/functions.py

I have a question about the way "space" is handled. My problem is
this, I'd like to create several instances of PolymorphicFn on the
interpreter level, so I can register some types with the function when
the module is loaded. However, I'm not sure how I should do this. If I
don't implement __new__ pypy complains that "using object.__new__ is
dangerous, use MyClass.__new__ instead". However, if I implement
__new__ I have to pass a space object in.

Anyway, I'm sorry if I'm not making much sense here, but I guess I'm
not too clear on how to create "global" objects. For instance, given
my above functions.py file, how do I do this:

first = PolymorphicFn()
first.extend(space.type(space.wrap(None)), space.wrap(lambda w_x: None))
first.extend(Cons.typedef, Cons.typedef.rawdict("first"))

To do this, I need an instance of space, but how do I get this in a
global (module level) context?

Thanks for any help.

Timothy


More information about the pypy-dev mailing list