Message6628

Author amak
Recipients amak, asmeurer
Date 2011-09-03.01:54:28
SpamBayes Score 3.0361708e-10
Marked as misclassified No
Message-id <1315014868.82.0.285045687187.issue1777@psf.upfronthosting.co.za>
In-reply-to
Content
__slots__ is an cpython optimization hack, whereby certain metadata overhead is eliminated for variables that are declared in the __slots__ list/tuple. It also affects inheritance, particularly multiple inheritance.

http://stackoverflow.com/questions/472000/python-slots
http://dev.svetlyak.ru/using-slots-for-optimisation-in-python-en/

Having an empty __slots__ variable is a dirtier hack for modifying the readability of class attributes.

You need to 

A: Contact the original committer of the __slots__ optimisation and *make* them justify their commit. They need to rationalize *why* their commit is a benefit to a code base that is expected to run on multiple python versions, e.g. cpython, jython, ironpython, pypy, etc. Have they tested on all of the target platforms? If not, the change should be rejected.

B: Hack around it (jythonistas have to do this all the time: cpython developers seem to have an attitude that cpython running on their favourite operating system is the only python on the world).

This should work

try:
    import java
except ImportError:
    __slots__ = []
History
Date User Action Args
2011-09-03 01:54:28amaksetmessageid: <1315014868.82.0.285045687187.issue1777@psf.upfronthosting.co.za>
2011-09-03 01:54:28amaksetrecipients: + amak, asmeurer
2011-09-03 01:54:28amaklinkissue1777 messages
2011-09-03 01:54:28amakcreate