Message 330572 - Python tracker

Message330572

Author methane
Recipients Dan Rose, brett.cannon, mark.dickinson, methane, miss-islington, serhiy.storchaka, terry.reedy, tim.peters, vstinner
Date 2018-11-28.03:13:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1543374840.38.0.788709270274.issue34100@psf.upfronthosting.co.za>
In-reply-to
Content
I agree that modifying tuple is bad idea in general case.

But in case of constants, in-place modify is the easiest approach.

Our purpose is "merging" constant.  On the other hand, "build new tuple and
replace old tuple" approach makes two same constant tuples.
If old tuple is referenced from somewhere, we fail to "merging".

So I don't think we need to follow the general principle unless it reduces code.

FYI, we have similar in-place editing for interning already.
https://github.com/python/cpython/blob/master/Objects/codeobject.c#L47-L95
History
Date User Action Args
2018-11-28 03:14:00methanesetrecipients: + methane, tim.peters, brett.cannon, terry.reedy, mark.dickinson, vstinner, serhiy.storchaka, miss-islington, Dan Rose
2018-11-28 03:14:00methanesetmessageid: <1543374840.38.0.788709270274.issue34100@psf.upfronthosting.co.za>
2018-11-28 03:14:00methanelinkissue34100 messages
2018-11-28 03:13:59methanecreate