Why is this?

Peter Mott peter at monicol.co.uk
Sat Aug 13 00:19:22 CEST 2005


Duncan Booth wrote:
> Peter Mott wrote:
> 
> 
>>But it is still true that [[]] + [[]] is not the same as [[]] * 2. In my 
>>usage anyway this means that "S+S is the same as S*2" is false. Because 
>>there are Python expressions for which it is falsfied.
>>
>>The problem I have is pretty philosophical I admit, but I don't think 
>>you do it justice. It's really about identity. 
> 
> 
> So would you expect:
> 
>     random.seed(0)
>     random.random() + random.random()
> 
> and:
> 
>     random.seed(0)
>     random.random() * 2
> 
> to be the same? The first call to random() in each case returns the same 
> result, but even though the source text is identical the second call 
> in the addition returns something different. It is just the same with the 
> lists.

I don't see that this bears on what I said at all.

Peter



More information about the Python-list mailing list