Re: [Python-Dev] Non-string keys in namespace dicts

2007-12-03 Thread Neil Toronto
Phillip J. Eby wrote: > At 10:17 PM 12/3/2007 -0700, Neil Toronto wrote: >> Interesting. But I'm going to have to say it probably wouldn't work as >> well, since C code can and does alter tp_dict directly. Those places in >> the core would have to be altered to invalidate the cache. > > Eh? Where

Re: [Python-Dev] Non-string keys in namespace dicts

2007-12-03 Thread Neil Toronto
Phillip J. Eby wrote: > At 03:51 PM 12/3/2007 -0800, Guido van Rossum wrote: >> On Dec 3, 2007 3:48 PM, Phillip J. Eby <[EMAIL PROTECTED]> wrote: >> > Actually, you're missing the part where such evil code *can't* muck >> > things up for class dictionaries. Type dicts aren't reachable via >> > ord

Re: [Python-Dev] Non-string keys in namespace dicts

2007-12-03 Thread Phillip J. Eby
At 10:17 PM 12/3/2007 -0700, Neil Toronto wrote: >Phillip J. Eby wrote: > > Actually, you're missing the part where such evil code *can't* muck > > things up for class dictionaries. Type dicts aren't reachable via > > ordinary Python code; you *have* to modify them via setattr. (The > > __dict__

Re: [Python-Dev] Non-string keys in namespace dicts

2007-12-03 Thread Neil Toronto
I apologize - I had forgotten what you were telling me by the time I replied. Here's a better answer. > Phillip J. Eby wrote: >> At 03:26 PM 12/3/2007 -0700, Neil Toronto wrote: >> Actually, you're missing the part where such evil code *can't* muck >> things up for class dictionaries. Type dict

Re: [Python-Dev] Non-string keys in namespace dicts

2007-12-03 Thread Phillip J. Eby
At 03:51 PM 12/3/2007 -0800, Guido van Rossum wrote: >On Dec 3, 2007 3:48 PM, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > > Actually, you're missing the part where such evil code *can't* muck > > things up for class dictionaries. Type dicts aren't reachable via > > ordinary Python code; you *have*

Re: [Python-Dev] Non-string keys in namespace dicts

2007-12-03 Thread Neil Toronto
Phillip J. Eby wrote: > At 03:26 PM 12/3/2007 -0700, Neil Toronto wrote: >> Phillip J. Eby wrote: >> > At 12:27 PM 12/3/2007 -0700, Neil Toronto wrote: >> Some version of the non-string keys problem would exist with any caching >> mechanism, though. An evil rich compare can always monkey about with

Re: [Python-Dev] Non-string keys in namespace dicts

2007-12-03 Thread Guido van Rossum
On Dec 3, 2007 3:48 PM, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > Actually, you're missing the part where such evil code *can't* muck > things up for class dictionaries. Type dicts aren't reachable via > ordinary Python code; you *have* to modify them via setattr. (The > __dict__ of types retur

Re: [Python-Dev] Non-string keys in namespace dicts

2007-12-03 Thread Phillip J. Eby
At 03:26 PM 12/3/2007 -0700, Neil Toronto wrote: >Phillip J. Eby wrote: > > At 12:27 PM 12/3/2007 -0700, Neil Toronto wrote: > >> Guido van Rossum wrote: > >> > How about subclasses of str? These have all the same issues... > >> > >> Yeah. I ended up having it, per class, permanently revert to unca

Re: [Python-Dev] Non-string keys in namespace dicts

2007-12-03 Thread Neil Toronto
Phillip J. Eby wrote: > At 12:27 PM 12/3/2007 -0700, Neil Toronto wrote: >> Guido van Rossum wrote: >> > How about subclasses of str? These have all the same issues... >> >> Yeah. I ended up having it, per class, permanently revert to uncached >> lookups when it detects that a class dict in the MRO

Re: [Python-Dev] Non-string keys in namespace dicts

2007-12-03 Thread Phillip J. Eby
At 12:27 PM 12/3/2007 -0700, Neil Toronto wrote: >Guido van Rossum wrote: > > On Dec 2, 2007 12:49 PM, Neil Toronto <[EMAIL PROTECTED]> wrote: > >> It turned out not *that* hard to code around for attribute caching, and > >> the extra cruft only gets invoked on a cache miss. The biggest problem > >

Re: [Python-Dev] Non-string keys in namespace dicts

2007-12-03 Thread Neil Toronto
Guido van Rossum wrote: > On Dec 2, 2007 12:49 PM, Neil Toronto <[EMAIL PROTECTED]> wrote: >> It turned out not *that* hard to code around for attribute caching, and >> the extra cruft only gets invoked on a cache miss. The biggest problem >> isn't speed - it's that it's possible (though extremely

Re: [Python-Dev] Non-string keys in namespace dicts

2007-12-03 Thread Guido van Rossum
On Dec 2, 2007 12:49 PM, Neil Toronto <[EMAIL PROTECTED]> wrote: > It turned out not *that* hard to code around for attribute caching, and > the extra cruft only gets invoked on a cache miss. The biggest problem > isn't speed - it's that it's possible (though extremely unlikely), while > testing ke

Re: [Python-Dev] Non-string keys in namespace dicts

2007-12-03 Thread Guido van Rossum
On Dec 2, 2007 6:28 PM, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > I don't see a problem with requiring dictionary key comparisons to be > side-effect-free - even in the general case of dictionaries, not just > namespace ones. Me neither -- but the problem is enforcement. -- --Guido van Rossum

Re: [Python-Dev] blocking a non-blocking socket

2007-12-03 Thread Bill Janssen
Thanks, Audun. If you look at the code, you'll see that both a connect method and a do_handshake method already exist, and work pretty much as you describe. The issue is what to do when the user doesn't use them -- specifies do_handshake_on_connect=True. > Another way of doing it could be to exp

Re: [Python-Dev] [poll] New name for __builtins__

2007-12-03 Thread Nick Coghlan
Guido van Rossum wrote: > On Dec 2, 2007 7:40 AM, Nick Coghlan <[EMAIL PROTECTED]> wrote: >> Just for the record, I also like the idea of __builtins__ being a magic >> alias for the boringly-but-practically named builtins module. > > [Imagine me jumping up and down and screaming at the top of my l