[pypy-dev] Alternatives to multiple inheritance

Ryan Gonzalez rymg19 at gmail.com
Fri Apr 18 21:50:28 CEST 2014


That makes sense! Thanks a lot!


On Fri, Apr 18, 2014 at 1:44 AM, Armin Rigo <arigo at tunes.org> wrote:

> Hi Ryan,
>
> On 18 April 2014 01:13, Benjamin Peterson <benjamin at python.org> wrote:
> > On Thu, Apr 17, 2014, at 15:42, Ryan Gonzalez wrote:
> >> The exception object needs to
> >> derive from my base class in order for me to use polymorphism inside the
> >> interpreter. However, it also needs to derive from the Exception class
> to
> >> be throwable.
> >
> > In this case, you may want to do what the PyPy Python interpreter does.
> > There is one interpreter level exception for app-level exceptions called
> > OperationError. OperationError wraps the app-level exception object
> > inside of it.
>
> In other words, the easiest is to have a class OpError(Exception) that
> wraps your real exception object; then raise and catch
> "OpError(your_object)" and don't do anything else with the OpError
> class.
>
> RPython is not C++ is that you can't throw and catch random things
> (like integers...).  But then it is not C++ in that it has better
> malloc-removal support :-)
>
>
> A bientôt,
>
> Armin.
>



-- 
Ryan
If anybody ever asks me why I prefer C++ to C, my answer will be simple:
"It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think that was
nul-terminated."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20140418/93a723a3/attachment.html>


More information about the pypy-dev mailing list