[pypy-dev] Re: specfic questions for getting into the code for first time

Michael Hudson mwh at python.net
Fri Jul 11 15:35:13 CEST 2003


Hunter Peress <hfastjava at yahoo.com> writes:

> I was met with extreme apathy and active negativity and downright
> avoidance yesterday in the irc.

You were being pretty annoying, or at least you managed to
significantly irritate Moshe, Holger and myself, and while it might
just be us being cruel heartless bastards, it's also possible you were
doing something wrong.

> Code symbology:
> Types are implemented by the following convention: 

> W_TypeObject eg
> (W_SliceObject) but whats all the w_ ....._w stuff like w_globals or
> self.failUnless_w(space.lt(w('a'), w('b')))
>
> ...eg what is the distinction between upper and lower W ? maybe w
> means coming from the appspace ?  whereas W means only in objspace ?
> and _w means going into appspace ?

W_ usually is the name of a class, w_ usually the name of an instance
(of one of the W_ classes, in the StdObjSpace).

things named _w are usually containers that while not being wrapped
containers contain objects that are wrapped.

Oh, apart from the failUnless_w and similar methods on test.TestCase
-- these are variants of the usual TestCase methods that test for
appspace truth or appspace equality.

As you might be able to see, there aren't any really hard and fast
rules here.

>
> im also curious about how w()  and space.wrap() differ?

Many bits of code just do

w = space.wrap

and the beginning to reduce clutter later on.  So they don't differ.

> Tying it all together:
> it would also help me (and thereby anyone else thats new) if a full
> working function could be commented on, this is why i made the :
> http://codespeak.net/moin/pypy/moin.cgi/WalkThroughFunction page.

It's a little hard to see what would be done here.  A thorough
explanation of it would require explaining lots of things about
multimethods, which

a) would be a LOT of work
b) might be pointless as we're not sure we have the details of
   multimethods right yet.

> I immediately dived into PyPy -S and found that int->Long promotion
> wasnt working, that there is not yet a longobject.py implementation
> and that Longs dont even seem to work that well. all from:
>
> fact = lambda n:[1,0][n>0] or fact(n-1)*n
>
> then i tried fact(100) fact(1L) and fact(1)
>
> i want to work on these issues so that i can know how to swim around
> the source code, and then move on.

Hmm.  This might be quite hard for a first project, on thinking about
it.  You should probably look at how the int->float delegation works,
but, like I said I'm not sure the relavent details are totally settled
yet.

Cheers,
M.

-- 
  ROOSTA:  Ever since you arrived on this planet last night you've
           been going round telling people that you're Zaphod
           Beeblebrox, but that they're not to tell anyone else.
                    -- The Hitch-Hikers Guide to the Galaxy, Episode 7



More information about the Pypy-dev mailing list