[Python-ideas] Policy for altering sys.path

Nick Coghlan ncoghlan at gmail.com
Thu May 7 06:07:17 CEST 2015


On 7 May 2015 at 01:11, Chris Angelico <rosuav at gmail.com> wrote:
> On Thu, May 7, 2015 at 12:05 AM, Thomas Güttler
> <guettliml at thomas-guettler.de> wrote:
>> We run a custom sub class of list in sys.path. We set it in sitecustomize.py
>>
>> This instance get replace by a common list in lines like this:
>>
>> sys.path = glob.glob(os.path.join(WHEEL_DIR, "*.whl")) + sys.path
>
> Forgive the obtuse question, but wouldn't an __radd__ method resolve
> this for you?

If the custom subclass is implemented in Python or otherwise
implements the C level nb_add slot, yes, if it's implemented in C and
only provides sq_concat without nb_add, no (courtesy of
http://bugs.python.org/issue11477, which gets the operand precedence
dance wrong for sequence types that only implement the sequence
methods and not the corresponding numeric ones)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list