Cethric / pyeuclid

Automatically exported from code.google.com/p/pyeuclid
0 stars 0 forks source link

Improvement on _use_slots wizardry #22

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When inspecting the class hierarchy at run-time, I noticed that all inherit 
from object. Good, but... even the ones that inherit from another class also 
have 'object' listed explicitly: Point3(Vector3, Geometry, object), Ray3(Line3, 
object), and so on.

I understand this is a purely cosmetic nitpick, as it's a side product of the 
_use_slots magic that do no real harm.

But I guess I have a simple and elegant solution. On line 63, replace:

            return type.__new__(cls, name, bases + (object,), dct)

For

            return type.__new__(cls, name, bases or (object,), dct)

This way only classes that have no base will (explicitly) inherit from 'object'

Original issue reported on code.google.com by rodrigo....@gmail.com on 6 Aug 2014 at 3:12