On Tue, 17 May 2005 13:56:18 +0200,
Peter Dembinski <[EMAIL PROTECTED]> wrote:
> "Giovanni Bajo" <[EMAIL PROTECTED]> writes:
>> Peter Dembinski wrote:
>>
BTW, a typical performance optimization (not done automatically by
python) is to hoist unchanging-value expressions out of loops, and
"Giovanni Bajo" <[EMAIL PROTECTED]> writes:
> Peter Dembinski wrote:
>
>>> BTW, a typical performance optimization (not done automatically by
>>> python) is to hoist unchanging-value expressions out of loops, and
>>> obj.method is often such an expression, so you will this strategy
>>> when people
Peter Dembinski wrote:
>> BTW, a typical performance optimization (not done automatically by
>> python) is to hoist unchanging-value expressions out of loops, and
>> obj.method is often such an expression, so you will this strategy
>> when people try
>> to squeeze extra performance from their prog
[EMAIL PROTECTED] (Bengt Richter) writes:
[snap]
>>So, the interpreter creates new 'point in address space' every time
>>there is object-dot-method invocation in program?
[optimization]
> BTW, a typical performance optimization (not done automatically by python)
> is to hoist unchanging-value e
On Mon, 16 May 2005 16:57:12 GMT, Andrew Dalke <[EMAIL PROTECTED]> wrote:
>Peter Dembinski wrote:
>> So, the interpreter creates new 'point in address space' every time
>> there is object-dot-method invocation in program?
>
>Yes. That's why some code hand-optimizes inner loops by hoisting
>the bo
On Mon, 16 May 2005 18:30:47 +0200, Peter Dembinski <[EMAIL PROTECTED]> wrote:
>Skip Montanaro <[EMAIL PROTECTED]> writes:
>
>> kyo> Can someone explain why the id() return the same value, and
>> kyo> why these values are changing?
>>
>> Instance methods are created on-the-fly.
>
>So, th
Peter Dembinski wrote:
> So, the interpreter creates new 'point in address space' every time
> there is object-dot-method invocation in program?
Yes. That's why some code hand-optimizes inner loops by hoisting
the bound objection creation, as
data = []
data_append = data.append
for x in some_oth
Skip Montanaro <[EMAIL PROTECTED]> writes:
> kyo> Can someone explain why the id() return the same value, and
> kyo> why these values are changing?
>
> Instance methods are created on-the-fly.
So, the interpreter creates new 'point in address space' every time
there is object-dot-method
kyo guan wrote:
> Can someone explain why the id() return the same value, and why
> these values are changing? Thanks you.
a=A()
id(a.f)
> 11365872
id(a.g)
> 11365872
The Python functions f and g, inside of a class A, are
unbound methods. When accessed through an instan
On Mon, 16 May 2005 11:28:31 +0800, "kyo guan" <[EMAIL PROTECTED]> wrote:
>HI Skip:
>
> I want to check is there any change in the instance 's methods.
a=A()
a2=A()
a.f == a2.f
>False
a.f is a2.f
>False
a.f is a.f
>False
> If the instance methods are creat
o that? Thanks.
Kyo
> -Original Message-
> From: Skip Montanaro [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 16, 2005 11:09 AM
> To: kyo guan
> Cc: python-list@python.org
> Subject: Re: question about the id()
>
>
> kyo> Can someone explain why the i
kyo> Can someone explain why the id() return the same value, and why
kyo> these values are changing?
Instance methods are created on-the-fly. In your example the memory
associated with the a.f bound method (not the same as the unbound method
A.f) is freed before you reference a.g. That
HI ALL:
Can someone explain why the id() return the same value, and why these
values are changing? Thanks you.
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> class A(object):
...
13 matches
Mail list logo