Early binding as an option

Gelonida N gelonida at gmail.com
Wed Aug 3 00:54:24 CEST 2011


On 08/03/2011 12:26 AM, Chris Angelico wrote:
> On Tue, Aug 2, 2011 at 11:21 PM, Gelonida N <gelonida at gmail.com> wrote:
>> On the other hand: It might be interesting, that the early binding would
>> just take place when python is invoked with -O
>>
> 
> This could be an excellent safety catch, but on the other hand, it
> might destroy all value of the feature - once again, it would be
> optimizing in the sole case where the code is probably better
> rewritten in C.
> 
> Or would this be a sort of "half-way house" - this is where we need
> more performance, let's spend two minutes tweaking it in Python rather
> than dropping to C - to get some of the performance gains?

Not really sure.

I would guess, that really tight inner loops should be rewritten with
Cython (never tried it though) or in C if performance is really that
critical.

On the other hand it could be nice to get a certain performance increase
with some pragmas without rendering the code completely unreadable.

I have loads of places in my code, where name lookups were required only
at compile time or at the first time when code is executed.

For every consecutive call a cached object-reference could be used.







More information about the Python-list mailing list