Re: why cannot assign to function call
- From: Mark Wooding <mdw@xxxxxxxxxxxxxxxx>
- Date: Wed, 7 Jan 2009 03:49:02 +0000 (UTC)
Steven D'Aprano <steven@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
The only tricky thing is that items 1, 2 and 3 can be inside two
different boxes at the same time. There's no obvious real world analogy
to that without the boxes being nested. This ability for objects to be in
two places at once (or even to be inside themselves!) is one of the few
reasons why Python's use of references in the implementation needs to be
mentioned.
Ahh. So it /does/ need to be mentioned after all. But you're wrong:
it's not an implementation detail: it's an essential part of the
language semantics.
A better analogy. The objects are scattered across the floor. No
object is contained in another. However, we have a plentiful supply of
bits of string, each of which is tied to a Teflon-covered paperweight at
one end and has a blob of Blu-Tack on the other. Instead of putting
something in a box directly, what we do is grab a piece of string, stick
the Blu-Tack to the thing, and put the paperweight in the box. This
way, we can stick several bits of string to the same object and put the
paperweights in different boxes. Indeed, nothing stops us sticking two
bits of string to a box, and putting both paperweights inside that same
box. But fitting a box into itself twice requires origami skills that
frighten me.
The Teflon stops the Blu-Tack from sticking to the paperweights, 'cos
you're not allowed to do that.
There's a daemon who comes around periodically and cleans up the mess of
paperweights which aren't in boxes, and tidies away things which don't
have any string stuck to them any more, but really he's just an
implementation detail and you wouldn't need him if your floor was big
enough and you had enough bits of sufficiently long string.
-- [mdw]
.
- Follow-Ups:
- Re: why cannot assign to function call
- From: Steven D'Aprano
- Re: why cannot assign to function call
- From: Hendrik van Rooyen
- Re: why cannot assign to function call
- From: Steve Holden
- Re: why cannot assign to function call
- References:
- Re: why cannot assign to function call
- From: Derek Martin
- Re: why cannot assign to function call
- From: Marc 'BlackJack' Rintsch
- Re: why cannot assign to function call
- From: Grant Edwards
- Re: why cannot assign to function call
- From: Derek Martin
- Re: why cannot assign to function call
- From: Grant Edwards
- Re: why cannot assign to function call
- From: Derek Martin
- Re: why cannot assign to function call
- From: Steven D'Aprano
- Re: why cannot assign to function call
- From: Mark Wooding
- Re: why cannot assign to function call
- From: Aaron Brady
- Re: why cannot assign to function call
- From: Steven D'Aprano
- Re: why cannot assign to function call
- Prev by Date: Re: why cannot assign to function call
- Next by Date: Re: message of Exception
- Previous by thread: Re: why cannot assign to function call
- Next by thread: Re: why cannot assign to function call
- Index(es):
Relevant Pages
|