Re: Making immutable instances
- From: Ben Finney <bignose+hates-spam@xxxxxxxxxxxxxxx>
- Date: Fri, 25 Nov 2005 00:26:01 +1100 (EST)
Alex Martelli <aleax@xxxxxxxxxxxxxxxx> wrote:
> Ben Finney <bignose+hates-spam@xxxxxxxxxxxxxxx> wrote:
> > Why is "I want to make objects immutable" seen as "I don't trust
> > my users"? Are Python's existing immutable types also seen the
> > same way? If not, why the distinction?
>
> A type implemented in C offers different possibilities than one
> implemented in Python -- no deep conceptual reason, just practical
> ones.
So, in the hypothetical situation that all Python types were
implemented in pure Python, what would the ideal behaviour for
immutables be? Or would there be no immutables?
> I don't think that making it explicit that you intended to document
> the restriction would have changed my answer (although an explicit
> acknowlegment that you're looking for restrictions against
> accidental misuse rather than against determined attackers surely
> would).
I'm looking for a "consenting adults" restriction: classes will have
immutable instances only where it makes sense from the class protocol.
I'm not going to lose sleep over users who go looking for trouble.
--
\ "Think for yourselves and let others enjoy the privilege to do |
`\ so too." -- Voltaire, _Essay On Tolerance_ |
_o__) |
Ben Finney
.
- Follow-Ups:
- Re: Making immutable instances
- From: Alex Martelli
- Re: Making immutable instances
- From: Mike Meyer
- Re: Making immutable instances
- References:
- Making immutable instances
- From: Ben Finney
- Re: Making immutable instances
- From: Alex Martelli
- Re: Making immutable instances
- From: Ben Finney
- Re: Making immutable instances
- From: Alex Martelli
- Making immutable instances
- Prev by Date: Re: Why are there no ordered dictionaries?
- Next by Date: Your message to documentation awaits moderator approval
- Previous by thread: Re: Making immutable instances
- Next by thread: Re: Making immutable instances
- Index(es):