Re: [Python-Dev] Why is nb_inplace_power ternary?

2007-02-09 Thread Martin v. Löwis
Brett Cannon schrieb: > Seems reasonable to me. Is the argument of None passed in > automatically somewhere? There are few callers of nb_inplace_power at all (AFAICT, only PyNumber_InPlacePower); in turn, PyNumber_InPlacePower is called with the implicit Py_None always: - ceval.c, for INPLACE_P

Re: [Python-Dev] Why is nb_inplace_power ternary?

2007-02-09 Thread Martin v. Löwis
Raymond Hettinger schrieb: > That made sense, but my question was whether there would be benefit > to making the change in the middle of a major release. At worst, code > that is > currently working due to undefined behavior will stop working. I don't > see any offsetting benefit. ISTM that Py

Re: [Python-Dev] Why is nb_inplace_power ternary?

2007-02-09 Thread Martin v. Löwis
Greg Ewing schrieb: > Might we want to add an in-place version of the 3-arg > pow() function one day? If so, leaving the third argument > there could be useful. What could the syntax for that be? Instead of writing x = pow(x, n, 10) would you write x pow n = 10 ? or perhaps x ** n = 10 or x

Re: [Python-Dev] Adding timeout option to httplib...connect()

2007-02-09 Thread Martin v. Löwis
Guido van Rossum schrieb: > I recently needed to access an HTTP URL with a timeout. I ended up > monkey-patching httplib.HTTPConnection so that the connect() method > has an optional second paramer, timeout, defaulting to None; if not > None, a call to settimeout() is added right after successful c

Re: [Python-Dev] Adding timeout option to httplib...connect()

2007-02-09 Thread skip
Guido> I recently needed to access an HTTP URL with a timeout. I ended Guido> up monkey-patching httplib.HTTPConnection so that the connect() Guido> method has an optional second paramer, timeout, defaulting to Guido> None; if not None, a call to settimeout() is added right after

[Python-Dev] Why is nb_inplace_power ternary?

2007-02-09 Thread Jim Jewett
Greg Ewing schrieb: > Might we want to add an in-place version of the 3-arg > pow() function one day? If so, leaving the third argument > there could be useful. "Martin v. Löwis" martin at v.loewis.de replied: > What could the syntax for that be? > Instead of writing > x = pow(x, n, 10) Either

Re: [Python-Dev] Why is nb_inplace_power ternary?

2007-02-09 Thread Brett Cannon
On 2/9/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > Brett Cannon schrieb: > > Seems reasonable to me. Is the argument of None passed in > > automatically somewhere? > > There are few callers of nb_inplace_power at all (AFAICT, only > PyNumber_InPlacePower); in turn, PyNumber_InPlacePower is

Re: [Python-Dev] Adding timeout option to httplib...connect()

2007-02-09 Thread Fred L. Drake, Jr.
On Friday 09 February 2007 08:52, [EMAIL PROTECTED] wrote: > In principle it's probably a fine idea. We should consider if it's > possible to develop a uniform approach to timeouts for all the libraries > that use sockets though. Otherwise you run the risk of doing it in > different ways for

Re: [Python-Dev] Adding timeout option to httplib...connect()

2007-02-09 Thread Guido van Rossum
On 2/9/07, Fred L. Drake, Jr. <[EMAIL PROTECTED]> wrote: > On Friday 09 February 2007 08:52, [EMAIL PROTECTED] wrote: > > In principle it's probably a fine idea. We should consider if it's > > possible to develop a uniform approach to timeouts for all the libraries > > that use sockets though.

Re: [Python-Dev] Adding timeout option to httplib...connect()

2007-02-09 Thread skip
Guido> Didn't work for me, since my ap is a multi-threaded webserver and Guido> I only want one specific type of request to time out. Understood. Guido> I'm not going to change ftplib.py and all the others. Also understood. This has, as far as I know, been the response of everybody

Re: [Python-Dev] Adding timeout option to httplib...connect()

2007-02-09 Thread Guido van Rossum
You're not helping, Skip. Can you spend a minute looking at urllib2 and seeing how the two variants of my proposal (pass to constructor vs. pass to connect()) would impact on it? --Guido On 2/9/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Guido> Didn't work for me, since my ap is a mu

Re: [Python-Dev] Why is nb_inplace_power ternary?

2007-02-09 Thread Greg Ewing
Martin v. Löwis wrote: > Greg Ewing schrieb: > >> Might we want to add an in-place version of the 3-arg >> pow() function one day? > > What could the syntax for that be? It wouldn't be a syntax, just a function, e.g. ipow(x, n, 10) > Also, it would break existing __ipow__ implementations >