Re: Making immutable instances
- From: Steven D'Aprano <steve@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 26 Nov 2005 19:39:20 +1100
On Fri, 25 Nov 2005 23:20:05 -0500, Mike Meyer wrote:
> Steven D'Aprano <steve@xxxxxxxxxxxxxxxxxxxxxx> writes:
>> "Hmmm, the class designer didn't want me adding attributes to instances...
>> maybe he had a good reason for that..."
>
> When it was suggested that a facility for doing this be added to the
> language, I asked for a use case for it. Nobodies come up with a
> reason for placing such restriction on the client yet.
Oh, I think it is terribly unfair to call them nobodies, even if you don't
like their use-cases *grin*
> If you've got a use case, I'd be interested in hearing it.
frozenset perhaps? If it were needed once, it could be needed again.
The obvious case would be for a class where distinct instances that
compare equal but not identical map to the same value in a dict.
In any case, I'm not the one claiming that I need custom immutable
classes. I'm just suggesting that there is nothing non-Pythonic about
them. If Ben thinks he needs them, I'm sure he has put *far* more thought
into it than I have. I know Ben in RL, and he is not someone to make snap
judgements about turning Python into Some Other Language Just Because.
--
Steven.
.
- Follow-Ups:
- 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
- Re: Making immutable instances
- From: Ben Finney
- Re: Making immutable instances
- From: Mike Meyer
- Re: Making immutable instances
- From: Steven D'Aprano
- Re: Making immutable instances
- From: Mike Meyer
- Re: Making immutable instances
- From: Steven D'Aprano
- Re: Making immutable instances
- From: Mike Meyer
- Making immutable instances
- Prev by Date: Re: Python as Guido Intended
- Next by Date: Re: return in loop for ?
- Previous by thread: Re: Making immutable instances
- Next by thread: Re: Making immutable instances
- Index(es):
Relevant Pages
|