[C++-sig] Using destructors in the right way

2008-11-04 Thread Luciano M. Wolf
Hi all, I'm using boost::python to make bindings and now I got in trouble. I'm trying to avoid Python deleting my C++ class before other classes but I didn't find any clue on how to do this. Is there a way to tell boost that my object should be the last one to be deleted? Thanks in advance! Regar

Re: [C++-sig] mutable object has bogus __hash__

2008-11-04 Thread Matthew Scouten (TT)
I looks at what it would take to write proper hash functions. These classes have ridiculously complicated equality operators. I am going to throw a type error and any users who don't like it can bite me. Thanks guys. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] tho

Re: [C++-sig] mutable object has bogus __hash__

2008-11-04 Thread Alex Mohr
I would like to have the __hash__ not exist. These objects are mutable and should NOT be used as keys. Is there a way to hide it? If I have them throw NotImplemented will python do something sensible with that? Python raises a TypeError for unhashable things: >>> [1,2,3].__hash__() Traceback (

Re: [C++-sig] Contructor with "with_custodian_and_ward_postcall"

2008-11-04 Thread Renato Araujo
Hi To solve my previous problem I'm trying implement a class witch store the PyObject pointer. using this solution: http://www.boost.org/doc/libs/1_36_0/libs/python/doc/v2/faq.html#xref then during the destructor of my wrapper class I want destroy the PyObjects of my children with: object_wrappe

[C++-sig] mutable object has bogus __hash__

2008-11-04 Thread Matthew Scouten (TT)
I have a bunch of classes in c++ with operator== defined, and I exported it as __eq__. They apparently inherited object's __hash__ . All was well until my users started to put these objects in sets and use them as dict keys. Objects that have the compare equal do not have the same hash. This cause

Re: [C++-sig] [pybindgen] references?

2008-11-04 Thread Gustavo Carneiro
2008/11/4 Alan Baljeu <[EMAIL PROTECTED]> > Glad to read this here. I agree with you about the dislike thing. I can't > stand auto_ptr, and if I had to give an object control over the life of > another object I would generally choose a shared_ptr protocol. I mean, the > object existed fine befo

Re: [C++-sig] [pybindgen] references?

2008-11-04 Thread Alan Baljeu
Glad to read this here. I agree with you about the dislike thing. I can't stand auto_ptr, and if I had to give an object control over the life of another object I would generally choose a shared_ptr protocol. I mean, the object existed fine before passing it in. Why can't it survive independ

Re: [C++-sig] [pybindgen] references?

2008-11-04 Thread Gustavo Carneiro
2008/11/3 Stefan Seefeld <[EMAIL PROTECTED]> > Alan Baljeu wrote: > >> I just read the tutorial page on pybindgen, but it doesn't talk about >> reference types. 99% of my C++ code involves passing around things like >> foo&, so this is significant to me. How is it done? >> >> > > If you need fin

Re: [C++-sig] [pybindgen] references?

2008-11-04 Thread Hans Meine
On Tuesday 04 November 2008 01:18:47 Alan Baljeu wrote: > void baz(foo &x); > > If I have a foo, I call baz with it, foo's contents may change but it's > still the same object. I don't see an issue here, unless foo is a smart > pointer type. Sometimes, baz might store the reference (admittedly, t