Erlend Egeberg Aasland <erlend.aasl...@innova.no> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43908>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to