Author erlendaasland
Recipients Mark.Shannon, corona10, erlendaasland, gvanrossum, serhiy.storchaka, shihai1991, vstinner
Date 2021-04-25.09:37:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619343460.39.0.840506897717.issue43908@roundup.psfhosted.org>
In-reply-to
Content
The more I read about these issues, the more I feel reluctant to apply PR 25520. Why change the behaviour/traits of heap types without a proper discussion (or PEP)? Applying this PR feels like an arbitrary change. All the related issues and mailing list discussions seems to end without consensus, and fundamental questions (what is an immutable type? which types should be immutable? why is it a problem that a type is mutable?) seems to be avoided all the time.

And, as Victor points out in msg391596 (and which has also been pointed out by others in other discussions):
> Currently, the limitation of not being able to modify a built-in type is arbitrary, it's not a technical limitation

FWIW #1, in pypy3, datetime.timedelta.foo = 1 is ok; in python3 (3.7-3.10) it's not.

FWIW #2, in Python 3.9, functools.partialmethod is implemented in Python, and functools.partial is implemented in C as a static type:
$ python3.9
>>> import functools
>>> functools.partial.foo = 1  # is this a problem?
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can't set attributes of built-in/extension type 'functools.partial'
>>> functools.partialmethod.foo = 1  # is this a problem?


If I'm only bringing noise into the discussion, feel free to remove me from the nosy list.
History
Date User Action Args
2021-04-25 09:37:40erlendaaslandsetrecipients: + erlendaasland, gvanrossum, vstinner, Mark.Shannon, serhiy.storchaka, corona10, shihai1991
2021-04-25 09:37:40erlendaaslandsetmessageid: <1619343460.39.0.840506897717.issue43908@roundup.psfhosted.org>
2021-04-25 09:37:40erlendaaslandlinkissue43908 messages
2021-04-25 09:37:40erlendaaslandcreate