Lisandro Dalcin wrote:
> On 6/11/08, Eric Jonas <[EMAIL PROTECTED]> wrote:
> 
>> I've got cython base classes and I want to pickle subclasses of those
>>  cython base classes. But those subclasses could have just about anything
>>  as an attribute. Is that still going to screw me?
> 
> Yes, if your 'nodes' can have arbitrary Python attibutes, then
> implementing yourself a general mechanism ala pickle protocol is going
> to be a nightmare for you.

Not really, you just have each class implement a polymorphic 
serialize/deserialize method, and invoke it to do the real stuff. 
Perhaps a bit more hassle perhaps but hardly a "nightmare".

You can't really get around having a polymorphic method for every class 
to get top speed (dictionary creation, lookups and traversal, which any 
generic mechanism would use, is much slower).

I.e., if you want C speed, you need to write C-like static code and use 
more static algorithms. There's no way around that (except for a macro 
facility, which we don't have).

-- 
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to