[pypy-dev] Objects and types in the stdobjspace

holger krekel hpk at trillke.net
Sat Jun 7 08:51:51 MEST 2003


Hello Armin!

[Armin Rigo Thu, Jun 05, 2003 at 05:32:59PM +0200]
> Hello everybody,
> 
> Here is a technical note for the way Samuele and I implemented objects and
> types based on multimethods.

Thanks for the info although i can't fully grok it, yet, because some other
pieces are missing (also see below).

Btw, could someone from the Sweden sprint crew post some
notes about how the current pypy-source tree can be used? What is
expected to work (or if that list is shorter: what does not work :-).

I am especially interested in 

- how the new test-machinery works so i can make sure that i 
  don't break big stuff while trying to fix/play around 

- a recap of the current StdObjsSpace registration/multimethod
  mechanisms. 

- any "entry points" other than interactive.py? 

- is loading of python-modules of the underlying python version
  supported? 

> In objspace/std/ you will find for each type xxx two files: xxxobject.py and
> xxxtype.py. The former defines a class W_XxxObject. Each instance of
> W_XxxObject is seen by the user (i.e. the person using the language, i.e.
> application-level) as an object of type xxx. The xxxtype.py file, on the other
> hand, defines a class W_XxxType, which is expected to have exactly one
> instance, which is what the user sees as the xxx type object (e.g. the single
> instance of W_IntType is what the user sees as 'types.IntType' or 'int').

Is the distinction especially between 'W_TypeObject' and 'W_TypeType' 
really "right"? I thought that these two sort of fall together. 

Anyway, for starters, i just added (what i think) a correct 'repr' to the
W_TypeObject 

    def type_repr(space, w_obj):
        return space.wrap("<type '%s'>" % w_obj.typename)

I also noticed that string representations aka 

    "with'mixed'quotes" 

always result in 

    'with'mixed'quotes'

but i wasn't sure how to fix this. Any hints? 

thanks,

    holger


More information about the pypy-dev mailing list