[pypy-dev] Builtin types

Christian Tismer tismer at tismer.com
Fri Jan 24 17:08:56 CET 2003


Thomas Heller wrote:
> Christian Tismer <tismer at tismer.com> writes:
...

>>No, sorry. object is just a special case for deriving a
>>new-style class, see above.
>>They can also be created by deriving from builtin types,
>>or by using __slots__.
> 
> That's incorrect, IIUC.
> 
> __slots__ only has a special meaning for *new stype classes* only,
> it doesn't trigger anything in classes classes.

Yes, I forgot about that, you are right.

>>Furthermore, I'm going to propose an extension to the new
>>class system (at least for the MiniPy prototype) that goes
>>a bit further:
>>- __slots__ should get the ability to denote the type of
>>   a slot to be generated, especially ctypes types
> 
> 
> I'm not really understanding what you're proposing here.

I am trying to extend the new-style classes
that includes ctypes, somehow.

> You could look at ctypes as implementing 'typed slots' with
> C-compatible layout.

How is that so different from my idea?

...

>>- it should be possible to derive a class from nothing,
>>   not even from object or classic, but I'd like to describe
>>   a plain C structure by classes.
> 
> 
> This is maybe also something that ctypes already does.
> The B *class* above knows all about this C structure
> 
> struct B {
>     char x;
>     int y;
>     long long z;
> };
> 
> 
>>>>ctypes.sizeof(B)
> 
> 16

However, we have the same intent.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/



More information about the Pypy-dev mailing list