[Grok-dev] meet the Grok 1.0 release team
Martijn Faassen
faassen at startifact.com
Wed Dec 3 07:38:30 EST 2008
Hey,
On Wed, Dec 3, 2008 at 1:23 PM, Brandon Craig Rhodes
<brandon at rhodesmill.org> wrote:
> "Martijn Faassen" <faassen at startifact.com> writes:
>
>> I don't think the word 'pestering' is very appropriate.
>
> I guess I was having fun. :-) I'll try to sound more official.
>
>> To my knowledge tuples are allocated each time the code runs just as
>> much as lists are, and not only when the program runs first, otherwise
>> things like this wouldn't work:
>>
>> mytuple = a, b
>
> It looks to me like the interpreter builds tuples of constants only
> once:
>
>>>> def foo():
> ... return (1,2,3)
> ...
>>>> a = foo()
>>>> b = foo()
>>>> id(a)
> 3084583396L
>>>> id(b)
> 3084583396L
Looks like you're right. Interesting, I wonder how it manages to know
the difference internally.
Regards,
Martijn
More information about the Grok-dev
mailing list