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

2007-12-02 Thread Phillip J. Eby
At 08:09 PM 12/1/2007 -0700, Neil Toronto wrote: >Are there any use-cases for allowing namespace dicts (such as globals, >builtins and classes) to have non-string keys? Yes. See http://pypi.python.org/pypi/AddOns > I'm asking because I'm >planning on accelerating method lookups next, and the p

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

2007-12-02 Thread Bill Janssen
> Rather than temporarily > making it blocking by whatever means, some indication needs > to be returned that the operation would block, and a way > provided for the calling code to re-try later. > > If that can't reasonably be done, then passing a non-blocking > socket here should be an error. I

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

2007-12-02 Thread Greg Ewing
Bill Janssen wrote: > What I'd like to do is just use the socket API, > something like: > > blocking = self.getblocking() > try: > self.setblocking(1) > self.do_handshake() > finally: > self.setblocking(blocking) I'm not sure this is the right approach. If the c

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

2007-12-02 Thread Christian Heimes
Neil Toronto wrote: > It'd be nice to have a benchmark with a deep class hierarchy. Does > anybody know of one? Zope has some very complex and deep class hierarchies, especially when it comes down to Plone and Archetypes. Unfortunately Zope is still stuck with Python 2.4. Christian _

Re: [Python-Dev] StandardError removed from py3k

2007-12-02 Thread Brett Cannon
On Dec 2, 2007 1:49 PM, Georg Brandl <[EMAIL PROTECTED]> wrote: > Antoine Pitrou schrieb: > > Le dimanche 02 décembre 2007 à 12:08 -0800, Neal Norwitz a écrit : > >> Note that StandardError was removed from py3k. > > > > Out of curiosity, what is the reason for this? Another exception tree > > rear

Re: [Python-Dev] Problems with GeneratorExit deriving from Exception

2007-12-02 Thread Brett Cannon
On Dec 1, 2007 11:14 PM, Chad Austin <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > On Dec 1, 2007 2:38 PM, Chad Austin <[EMAIL PROTECTED]> wrote: > >> This problem could be solved in several ways: > >> > >> 1) Make GeneratorExit derive from BaseException, just like SystemExit. > > > > We

Re: [Python-Dev] StandardError removed from py3k

2007-12-02 Thread Georg Brandl
Antoine Pitrou schrieb: > Le dimanche 02 décembre 2007 à 12:08 -0800, Neal Norwitz a écrit : >> Note that StandardError was removed from py3k. > > Out of curiosity, what is the reason for this? Another exception tree > rearrangement? I think it was found not to serve a real purpose. Georg -- T

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

2007-12-02 Thread Aahz
On Sun, Dec 02, 2007, Neil Toronto wrote: > > Anyway, report: I've got an initial working attribute cache, using the > conveniently-named-and-left-NULL tp_cache. It's a nice speedup - except > on everything the standard benchmarks test, because their class > hierarchies are very shallow. :p If

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

2007-12-02 Thread Neil Toronto
Nicko van Someren wrote: > On 2 Dec 2007, at 03:09, Neil Toronto wrote: > >> Are there any use-cases for allowing namespace dicts (such as globals, >> builtins and classes) to have non-string keys? I'm asking because I'm >> planning on accelerating method lookups next, and the possibility of a >>

Re: [Python-Dev] Problems with GeneratorExit deriving from Exception

2007-12-02 Thread Antoine Pitrou
Le dimanche 02 décembre 2007 à 11:29 -0800, Chad Austin a écrit : > If socket.error, xmlrpclib.Fault, httplib.HTTPException, etc. all extended > StandardError, then we would probably be fine with that approach. But I > think > the majority of exceptions, both in the standard library and our co

Re: [Python-Dev] StandardError removed from py3k

2007-12-02 Thread Antoine Pitrou
Le dimanche 02 décembre 2007 à 12:08 -0800, Neal Norwitz a écrit : > Note that StandardError was removed from py3k. Out of curiosity, what is the reason for this? Another exception tree rearrangement? ___ Python-Dev mailing list Python-Dev@python.org

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

2007-12-02 Thread Oleg Broytmann
On Sun, Dec 02, 2007 at 12:23:01PM -0800, Bill Janssen wrote: [skip] > Or, should I just set the timeout: > > timeout = self.gettimeout() > try: > self.settimeout(None) > self.do_handshake() > finally: > self.settimeout(timeout) Yes, this is the correct soluti

[Python-Dev] blocking a non-blocking socket

2007-12-02 Thread Bill Janssen
An interesting question has come up in the development of the SSL module. The function ssl.wrap_socket() takes a flag, do_handshake_on_connect, which tells it whether to do the SSL handshake before returning an SSLSocket object to the caller. If the socket being wrapped is non-blocking, the code

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

2007-12-02 Thread Georg Brandl
Guido van Rossum schrieb: > 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

Re: [Python-Dev] Problems with GeneratorExit deriving from Exception

2007-12-02 Thread Neal Norwitz
On Dec 2, 2007 11:29 AM, Chad Austin <[EMAIL PROTECTED]> wrote: > Hi Antoine, > > Antoine Pitrou wrote: > > Hi, > > > > (I was asked to forward this from the bug tracker) > > > >> We have also run into problems where a task tries to "return" (yield > >> Return()) > >> from within a try: except Exc

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

2007-12-02 Thread Guido van Rossum
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 lungs out of frustration:] BUT T

Re: [Python-Dev] Problems with GeneratorExit deriving from Exception

2007-12-02 Thread Chad Austin
Hi Antoine, Antoine Pitrou wrote: > Hi, > > (I was asked to forward this from the bug tracker) > >> We have also run into problems where a task tries to "return" (yield >> Return()) >> from within a try: except Exception: block. Since returning from a >> coroutine is >> roughly equivalent to

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

2007-12-02 Thread Nicko van Someren
On 2 Dec 2007, at 03:09, Neil Toronto wrote: > Are there any use-cases for allowing namespace dicts (such as globals, > builtins and classes) to have non-string keys? I'm asking because I'm > planning on accelerating method lookups next, and the possibility of a > key compare changing the underlyi

Re: [Python-Dev] Problems with GeneratorExit deriving from Exception

2007-12-02 Thread Georg Brandl
Antoine Pitrou schrieb: > Hi, > > (I was asked to forward this from the bug tracker) > >> We have also run into problems where a task tries to "return" (yield >> Return()) >> from within a try: except Exception: block. Since returning from a >> coroutine is >> roughly equivalent to "raise Gene

Re: [Python-Dev] Decimal news: speedup and stabilization

2007-12-02 Thread Nick Coghlan
Facundo Batista wrote: > 2007/11/24, Nick Coghlan <[EMAIL PROTECTED]>: > >> Did you change the Decimal repr to use the same format for the mantissa? > > I don't understand the question. The output of repr() does not show > this internals... Yeah, um... can we just forget I asked that question? (

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

2007-12-02 Thread Nick Coghlan
Fred Drake wrote: > I suspect that's indistinguishable from everyone being tired of the > discussion, knowing that you're going to pick something reasonable in > spite of our yammering. What Fred said. It's Guido's bikeshed, he can choose the colour :) Just for the record, I also like the ide

Re: [Python-Dev] Update to PEP 366 (Relative imports from the main module)

2007-12-02 Thread Nick Coghlan
Guido van Rossum wrote: > This looks good. Please make the appropriate changes to the PEP and to > PEP 0 to mark it as accepted. I should get to that in the next day or two. Thanks. > I think the implementation is fine too (others will have to check it > more carefully) but I noticed that the pro

Re: [Python-Dev] Problems with GeneratorExit deriving from Exception

2007-12-02 Thread Nick Coghlan
Guido van Rossum wrote: > Well argued. I suggest to go for option (1) -- make GeneratorExit > inherit from BaseException. We can do this starting 2.6. Feel free to > upload a patch to bugs.python.org. It actually took me a while to figure out why this use case was convincing, when the same idea h

[Python-Dev] Problems with GeneratorExit deriving from Exception

2007-12-02 Thread Antoine Pitrou
Hi, (I was asked to forward this from the bug tracker) > We have also run into problems where a task tries to "return" (yield Return()) > from within a try: except Exception: block. Since returning from a coroutine > is > roughly equivalent to "raise GeneratorExit", the exception can be caught