[Python-Dev] cProfile with generator throwing

2007-06-08 Thread Eyal Lotem
Hi. It seems that cProfile does not support throwing exceptions into generators properly, when an external timer routine is used. The problem is that _lsprof.c: ptrace_enter_call assumes that there are no exceptions set when it is called, which is not true when the generator frame is being gen_sen

[Python-Dev] Instance variable access and descriptors

2007-06-09 Thread Eyal Lotem
Hi. I was surprised to find in my profiling that instance variable access was pretty slow. I looked through the CPython code involved, and discovered something that really surprises me. Python, probably through the valid assumption that most attribute lookups go to the class, tries to look for t

[Python-Dev] Frame zombies

2007-06-09 Thread Eyal Lotem
I was just looking through the code that handles frames (as part of my current effort to determine how to improve on CPython's performance), when I noticed the freelist/zombie mechanism for frame allocation handling. While the zombie mechanism seems like a nice optimization, I believe there can be

Re: [Python-Dev] Instance variable access and descriptors

2007-06-09 Thread Eyal Lotem
Kevin > > > > On 6/9/07, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > > > > At 12:23 AM 6/10/2007 +0300, Eyal Lotem wrote: > > >A. It will break code that uses instance.__dict__['var'] directly, > > >when 'var' exists as a property wit

[Python-Dev] Fwd: Instance variable access and descriptors

2007-06-09 Thread Eyal Lotem
On 6/10/07, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 12:23 AM 6/10/2007 +0300, Eyal Lotem wrote: > >A. It will break code that uses instance.__dict__['var'] directly, > >when 'var' exists as a property with a __set__ in the class. I believe > >

Re: [Python-Dev] Frame zombies

2007-06-09 Thread Eyal Lotem
The freelist currently serves as a good optimization of a special case of a recurring recursion. If the same code object (or one of the same size) is used for recursive calls repeatedly, the freelist will realloc-to-same-size (which probably has no serious cost) and thus the cost of allocating/dea

Re: [Python-Dev] Frame zombies

2007-06-10 Thread Eyal Lotem
On 6/10/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > Note that _only_ recursions will have more than 1 frame attached. > > That's not true; in the presence of threads, the same method > may also be invoked more than one time simultaneously. Yes, I have missed that, and realized that I miss

[Python-Dev] Question about dictobject.c:lookdict_string

2007-06-10 Thread Eyal Lotem
My question is specifically regarding the transition back from lookdict_string (the initial value) to the general lookdict. Currently, when a string-only dict is trying to look up any non-string, it reverts back to a general lookdict. Wouldn't it be better (especially in the more important case o

Re: [Python-Dev] Question about dictobject.c:lookdict_string

2007-06-12 Thread Eyal Lotem
On 6/11/07, Carl Friedrich Bolz <[EMAIL PROTECTED]> wrote: > Eyal Lotem wrote: > > My question is specifically regarding the transition back from > > lookdict_string (the initial value) to the general lookdict. > > > > Currently, when a string-only dict is trying

[Python-Dev] Cycle collection enhancement idea

2008-06-28 Thread Eyal Lotem
I see why a cycle that has multiple objects with a __del__ method is a problem. Once you call __del__ on one of the objects, its no longer usable by the others, and its not clear which order is correct. My question regards the case where a cycle of objects only has 1 object which has a __del__.

Re: [Python-Dev] Cycle collection enhancement idea

2008-06-29 Thread Eyal Lotem
On Sun, Jun 29, 2008 at 9:00 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >> As I explained above, it *is* part of a cycle: """including >> the class objects themselves: class->dict->function->func_globals""". > > Ah, right. I must have missed that explanation. > >> I know. I assumed Python doe

[Python-Dev] Security capabilities in Python

2005-04-08 Thread Eyal Lotem
I would like to experiment with security based on Python references as security capabilities. Unfortunatly, there are several problems that make Python references invalid as capabilities: * There is no way to create secure proxies because there are no private attributes. * Lots of Python objects

Re: [Python-Dev] Security capabilities in Python

2005-04-10 Thread Eyal Lotem
It may be really hard to get it right, unless we are overlooking some simple solution.I disagree that we should "just use OS protections".The reason I am interested in Pythonic protection is because it is so much more powerful than OS protections.  The capability model is much more powerful than th

[Python-Dev] Early PEP draft (For Python 3000?)

2005-10-12 Thread Eyal Lotem
I would like to re-suggest a suggestion I have made in the past, but with a mild difference, and a narrower scope. Name: Attribute access for all namespaces Rationale: globals() access is conceptually the same as setting the module's attributes but uses a different idiom (access of the dict direc

Re: [Python-Dev] Assignment to __class__ of module? (Autoloading? (Making Queue.Queue easier to use))

2005-10-13 Thread Eyal Lotem
Why not lazily import modules by importing them when they are needed (i.e inside functions), and not in the top-level module scope? On 10/13/05, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 04:02 PM 10/13/2005 +0100, Michael Hudson wrote: > >Greg Ewing <[EMAIL PROTECTED]> writes: > > > > > Phil

[Python-Dev] Class decorators vs metaclasses

2005-11-04 Thread Eyal Lotem
I have a few claims, some unrelated, and some built on top of each other. I would like to hear your responses as to which are convincing, which arne't, and why. I think that if these claims are true, Python 3000 should change quite a bit. A. Metaclass code is black magic and few understand how it

Re: [Python-Dev] Class decorators vs metaclasses

2005-11-05 Thread Eyal Lotem
On 11/5/05, Alex Martelli <[EMAIL PROTECTED]> wrote: > On 11/4/05, Eyal Lotem <[EMAIL PROTECTED]> wrote: > > I have a few claims, some unrelated, and some built on top of each > > other. I would like to hear your responses as to which are > > convincing, which