Re: [Python-Dev] draft of externally maintained packages PEP

2006-04-30 Thread Fredrik Lundh
Brett Cannon wrote: > ElementTree > --- > - Web page > http://effbot.org/zone/element-index.htm > - Standard library name > xml.etree > - Contact person > Fredrik Lundh > - Synchronisation history > * 1.2.6 (2.5) xml.etree contains components from both ElementTree and and

Re: [Python-Dev] PEP 3102: Keyword-only arguments

2006-04-30 Thread Martin v. Löwis
Terry Reedy wrote: >> Now, suppose you wanted to have 'key' be a keyword-only argument. > > Why? Why not let the user type the additional argument(s) without the > parameter name? Are you asking why that feature (keyword-only arguments) is desirable? That's the whole point of the PEP. Or ar

Re: [Python-Dev] PEP 3102: Keyword-only arguments

2006-04-30 Thread Thomas Wouters
On 4/30/06, Steven Bethard <[EMAIL PROTECTED]> wrote: On 4/29/06, Talin <[EMAIL PROTECTED]> wrote:>  This PEP proposes a change to the way that function arguments are>  assigned to named parameter slots.  In particular, it enables the >  declaration of "keyword-only" arguments: argument

Re: [Python-Dev] methods on the bytes object (was: Crazy idea for str.join)

2006-04-30 Thread Josiah Carlson
"Guido van Rossum" <[EMAIL PROTECTED]> wrote: > On 4/29/06, Josiah Carlson <[EMAIL PROTECTED]> wrote: > > I understand the underlying implementation of str.join can be a bit > > convoluted (with the auto-promotion to unicode and all), but I don't > > suppose there is any chance to get str.join to

Re: [Python-Dev] methods on the bytes object

2006-04-30 Thread Martin v. Löwis
Josiah Carlson wrote: > Specifically in the case of bytes.join(), the current common use-case of > .join(...) would become something similar to > bytes().join(...), unless bytes objects got a syntax... Or > maybe I'm missing something? I think what you are missing is that algorithms that currently

[Python-Dev] Problem with inspect and PEP 302

2006-04-30 Thread Georg Brandl
Recently, the inspect module was updated to conform with PEP 302. Now this is broken: >>> import inspect >>> inspect.stack() The traceback shows clearly what's going on. However, I don't know how to resolve the problem. Georg ___ Python-Dev mailing l

Re: [Python-Dev] rich comparisions and old-style classes

2006-04-30 Thread Armin Rigo
Hi Fredrik, On Sun, Apr 30, 2006 at 08:13:40AM +0200, Fredrik Lundh wrote: > trying to come up with a more concise description of the rich > comparision machinery for pyref.infogami.com, That's quite optimistic. It's a known dark area. > I stumbled upon an oddity that I cannot really explain:

Re: [Python-Dev] rich comparisions and old-style classes

2006-04-30 Thread Michael Foord
Armin Rigo wrote: > Hi Fredrik, > > On Sun, Apr 30, 2006 at 08:13:40AM +0200, Fredrik Lundh wrote: > >> trying to come up with a more concise description of the rich >> comparision machinery for pyref.infogami.com, >> > > That's quite optimistic. It's a known dark area. > > >> I stumble

Re: [Python-Dev] PEP 3102: Keyword-only arguments

2006-04-30 Thread Nick Coghlan
Terry Reedy wrote: > "Talin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> Now, suppose you wanted to have 'key' be a keyword-only argument. > > Why? Why not let the user type the additional argument(s) without the > parameter name? Because for some functions (e.g. min()/ma

Re: [Python-Dev] PEP 3101: Advanced String Formatting

2006-04-30 Thread Aahz
First of all, I recommend that you post this to comp.lang.python. This is the kind of PEP where wide community involvement is essential to success; be prepared for massive revision. (My point about massive revision would be true regardless of how much consensus has been reached on python-dev -- P

[Python-Dev] More on contextlib - adding back a contextmanager decorator

2006-04-30 Thread Nick Coghlan
A few things from the pre-alpha2 context management terminology review have had a chance to run around in the back of my head for a while now, and I'd like to return to a topic Paul Moore brought up during that discussion. Paul had a feeling there should be two generator decorators in contextlib

[Python-Dev] Adding functools.decorator

2006-04-30 Thread Nick Coghlan
Collin Winters has done the work necessary to rename PEP 309's functional module to functools and posted the details to SF [1]. I'd like to take that patch, tweak it so the C module is built as _functools rather than functools, and then add a functools.py consisting of: from _functools import *

[Python-Dev] PyThreadState_SetAsyncExc and native extensions

2006-04-30 Thread Gabriel Becedillas
Does anyone know if PyThreadState_SetAsyncExc stops a thread while its inside a native extension ? I'm trying to stop a testing script that boils down to this: while True: print "aaa" native_extension_call() print "bbb" Using PyThreadState_SetAsyncExc the module doesn't stop but if

[Python-Dev] __getslice__ usage in sre_parse

2006-04-30 Thread Sanghyeon Seo
Hello, Python language reference 3.3.6 deprecates __getslice__. I think it's okay that UserList.py has it, but sre_parse shouldn't use it, no? __getslice__ is not implemented in IronPython and this breaks usage of _sre.py, a pure-Python implementation of _sre, on IronPython: http://ubique.ch/code

[Python-Dev] elimination of scope bleeding of iteration variables

2006-04-30 Thread Ben Wing
apologies if this has been brought up on python-dev already. a suggestion i have, perhaps for python 3.0 since it may break some code (but imo it could go into 2.6 or 2.7 because the likely breakage would be very small, see below), is the elimination of the misfeature whereby the iteration vari

Re: [Python-Dev] elimination of scope bleeding of iteration variables

2006-04-30 Thread Nick Coghlan
Ben Wing wrote: > apologies if this has been brought up on python-dev already. > > a suggestion i have, perhaps for python 3.0 since it may break some code > (but imo it could go into 2.6 or 2.7 because the likely breakage would > be very small, see below), is the elimination of the misfeature w

Re: [Python-Dev] Adding functools.decorator

2006-04-30 Thread Simon Belak
Nick Coghlan wrote: > Some details that are up for discussion: > > - which of a function's special attributes should be copied/updated? > - should the __decorates__ and __decorator__ attributes be added? > > If people are happy with this idea, I can make sure it happens before > alpha > 3. Wh

Re: [Python-Dev] methods on the bytes object

2006-04-30 Thread Guido van Rossum
On 4/30/06, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > Josiah Carlson wrote: > > Specifically in the case of bytes.join(), the current common use-case of > > .join(...) would become something similar to > > bytes().join(...), unless bytes objects got a syntax... Or > > maybe I'm missing somethi

Re: [Python-Dev] Adding functools.decorator

2006-04-30 Thread Georg Brandl
Nick Coghlan wrote: > Collin Winters has done the work necessary to rename PEP 309's functional > module to functools and posted the details to SF [1]. > > I'd like to take that patch, tweak it so the C module is built as _functools > rather than functools, and then add a functools.py consisting

Re: [Python-Dev] __getslice__ usage in sre_parse

2006-04-30 Thread Guido van Rossum
On 4/28/06, Sanghyeon Seo <[EMAIL PROTECTED]> wrote: > Hello, > > Python language reference 3.3.6 deprecates __getslice__. I think it's > okay that UserList.py has it, but sre_parse shouldn't use it, no? Well, as long as the deprecated code isn't removed, there's no reason why other library code s

Re: [Python-Dev] PyThreadState_SetAsyncExc and native extensions

2006-04-30 Thread Aahz
On Fri, Apr 28, 2006, Gabriel Becedillas wrote: > > Does anyone know if PyThreadState_SetAsyncExc stops a thread while its > inside a native extension ? Please take this question to comp.lang.python; python-dev is for discussion about changes to the Python interpreter/language, not for questions a

Re: [Python-Dev] methods on the bytes object

2006-04-30 Thread Phillip J. Eby
At 08:22 AM 4/30/2006 -0700, Guido van Rossum wrote: >Still, I expect that having a bunch of string-ish methods on bytes >arrays would be convenient for certain types of data handling. Of >course, only those methods that don't care about character types would >be added, but that's a long list: star

Re: [Python-Dev] Adding functools.decorator

2006-04-30 Thread Guido van Rossum
On 4/30/06, Georg Brandl <[EMAIL PROTECTED]> wrote: > Nick Coghlan wrote: > > Collin Winters has done the work necessary to rename PEP 309's functional > > module to functools and posted the details to SF [1]. > > > > I'd like to take that patch, tweak it so the C module is built as _functools > >

Re: [Python-Dev] More on contextlib - adding back a contextmanager decorator

2006-04-30 Thread Guido van Rossum
On 4/30/06, Nick Coghlan <[EMAIL PROTECTED]> wrote: > A few things from the pre-alpha2 context management terminology review have > had a chance to run around in the back of my head for a while now, and I'd > like to return to a topic Paul Moore brought up during that discussion. I believe the con

Re: [Python-Dev] Adding functools.decorator

2006-04-30 Thread Georg Brandl
Guido van Rossum wrote: > On 4/30/06, Georg Brandl <[EMAIL PROTECTED]> wrote: >> Nick Coghlan wrote: >> > Collin Winters has done the work necessary to rename PEP 309's functional >> > module to functools and posted the details to SF [1]. >> > >> > I'd like to take that patch, tweak it so the C mod

Re: [Python-Dev] More on contextlib - adding back a contextmanagerdecorator

2006-04-30 Thread Fredrik Lundh
Guido van Rossum wrote: > I believe the context API design has gotten totally out of hand. > I have a counter-proposal: let's drop __context__. Heh. I was about to pull out the "if the implementation is hard to explain, it's a bad idea (and bad ideas shouldn't go into 2.X)" rule last week in resp

Re: [Python-Dev] [Python-3000] in-out parameters

2006-04-30 Thread Edward Loper
Rudy Rudolph wrote: > 2) pass-by-reference: > def f(wrappedParam): > wrappedParam[0] += 5 # ugh > return "this is my result" > > # call it > x = 2 > result = f([x]) > # also ugly, but x is now 7 This example is broken; here's what you get when you run it: >

Re: [Python-Dev] PEP 3102: Keyword-only arguments

2006-04-30 Thread Zachary Pincus
Some thoughts from a lurker, largely concerning syntax; discount as you wish. First: > Keyword-only arguments are not required to have a default value. > Since Python requires that all arguments be bound to a value, > and since the only way to bind a value to a keyword-only argume

Re: [Python-Dev] PEP 3102: Keyword-only arguments

2006-04-30 Thread Georg Brandl
Zachary Pincus wrote: > Some thoughts from a lurker, largely concerning syntax; discount as > you wish. > > First: >> Keyword-only arguments are not required to have a default value. >> Since Python requires that all arguments be bound to a value, >> and since the only way to bind

Re: [Python-Dev] methods on the bytes object

2006-04-30 Thread Martin v. Löwis
Guido van Rossum wrote: > Well, yes, in most cases, but while attempting to write an I/O library > I already had the urge to collect "chunks" I've read in a list and > join them later, instead of concatenating repeatedly. I guess I should > suppress this urge, and plan to optimize extending a bytes

Re: [Python-Dev] PEP 3101: Advanced String Formatting

2006-04-30 Thread Zachary Pincus
I'm not sure about introducing a special syntax for accessing dictionary entries, array elements and/or object attributes *within a string formatter*... much less an overloaded one that differs from how these elements are accessed in "regular python". > Compound names are a sequence of

Re: [Python-Dev] PEP 3101: Advanced String Formatting

2006-04-30 Thread Bill Janssen
> For most built-in types, the conversion specifiers will be the > same or similar to the existing conversion specifiers used with > the '%' operator. Thus, instead of '%02.2x", you will say > '{0:2.2x}'. Don't you mean, "{0:02.2x}"? Bill _

Re: [Python-Dev] PEP 3101: Advanced String Formatting

2006-04-30 Thread Georg Brandl
Zachary Pincus wrote: > I'm not sure about introducing a special syntax for accessing > dictionary entries, array elements and/or object attributes *within a > string formatter*... much less an overloaded one that differs from > how these elements are accessed in "regular python". Yes, I als

Re: [Python-Dev] PEP 3102: Keyword-only arguments

2006-04-30 Thread Joe Smith
"Talin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Abstract > > This PEP proposes a change to the way that function arguments are > assigned to named parameter slots. In particular, it enables the > declaration of "keyword-only" arguments: arguments that can only >

Re: [Python-Dev] methods on the bytes object

2006-04-30 Thread Josiah Carlson
"Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > Josiah Carlson wrote: > > Specifically in the case of bytes.join(), the current common use-case of > > .join(...) would become something similar to > > bytes().join(...), unless bytes objects got a syntax... Or > > maybe I'm missing something? > > I

Re: [Python-Dev] methods on the bytes object

2006-04-30 Thread Martin v. Löwis
Josiah Carlson wrote: >> I think what you are missing is that algorithms that currently operate >> on byte strings should be reformulated to operate on character strings, >> not reformulated to operate on bytes objects. > > By "character strings" can I assume you mean unicode strings which > conta

Re: [Python-Dev] PEP 3101: Advanced String Formatting

2006-04-30 Thread Martin v. Löwis
Aahz wrote: > First of all, I recommend that you post this to comp.lang.python. This > is the kind of PEP where wide community involvement is essential to > success; be prepared for massive revision. Actually, *all* PEPs should be posted to c.l.p at some point; the PEP author is responsible for c

Re: [Python-Dev] More on contextlib - adding back a contextmanager decorator

2006-04-30 Thread Phillip J. Eby
At 09:53 AM 4/30/2006 -0700, Guido van Rossum wrote: >I have a counter-proposal: let's drop __context__. Nearly all use >cases have __context__ return self. In the remaining cases, would it >really be such a big deal to let the user make an explicit call to >some appropriately named method? The onl

Re: [Python-Dev] Problem with inspect and PEP 302

2006-04-30 Thread Phillip J. Eby
At 12:13 PM 4/30/2006 +0200, Georg Brandl wrote: >Recently, the inspect module was updated to conform with PEP 302. > >Now this is broken: > > >>> import inspect > >>> inspect.stack() > >The traceback shows clearly what's going on. However, I don't know how >to resolve the problem. The problem as

Re: [Python-Dev] Tkinter lockups.

2006-04-30 Thread Martin v. Löwis
Jeff Epler wrote: > However, on this system, I couldn't recreate the problem you reported > with either the "using _tkinter directly" instructions, or using this > "C" test program: > > #include > #include > > int main(void) { > Tcl_Interp *trp; > unsetenv("DISPLAY"); > trp = Tcl_Cr

[Python-Dev] socket module recvmsg/sendmsg

2006-04-30 Thread Heiko Wundram
Hi all! I've implemented recvmsg and sendmsg for the socket module in my private Python tree for communication between two forked processes, which are essentially wrappers for proper handling of SCM_RIGHTS and SCM_CREDENTIALS Unix-Domain-Socket messages (which are the two types of messages that

Re: [Python-Dev] PEP 3102: Keyword-only arguments

2006-04-30 Thread Talin
Thomas Wouters python.org> writes: > Pfft, implementation is easy. I have the impression Talin wants to implement it himself, but even if he doesn't, I'm sure I'll have a free week somewhere in the next year and a half in which I can implement it :) It's not that hard a problem, it just requires

Re: [Python-Dev] PEP 3102: Keyword-only arguments

2006-04-30 Thread Talin
Zachary Pincus stanford.edu> writes: > That seems a bit odd, as my natural expectation wouldn't be to see > kw1 ands kw2 as required, no-default keyword args, but as misplaced > positional args. > > Perhaps this might be a little better? >def foo(*args, kw1=, kw2=): > I'm rather not sure

Re: [Python-Dev] PEP 3101: Advanced String Formatting

2006-04-30 Thread Talin
Zachary Pincus wrote: > I'm not sure about introducing a special syntax for accessing > dictionary entries, array elements and/or object attributes *within a > string formatter*... much less an overloaded one that differs from how > these elements are accessed in "regular python". > >>

Re: [Python-Dev] Adding functools.decorator

2006-04-30 Thread Brett Cannon
On 4/30/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 4/30/06, Georg Brandl <[EMAIL PROTECTED]> wrote: > > Nick Coghlan wrote: > > > Collin Winters has done the work necessary to rename PEP 309's functional > > > module to functools and posted the details to SF [1]. > > > > > > I'd like to t

Re: [Python-Dev] More on contextlib - adding back a contextmanager decorator

2006-04-30 Thread Brett Cannon
On 4/30/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 4/30/06, Nick Coghlan <[EMAIL PROTECTED]> wrote: > > A few things from the pre-alpha2 context management terminology review have > > had a chance to run around in the back of my head for a while now, and I'd > > like to return to a topic

Re: [Python-Dev] PEP 3101: Advanced String Formatting

2006-04-30 Thread Terry Reedy
"Talin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Compound names are a sequence of simple names seperated by separated > The string and unicode classes will have a class method called > 'cformat' that does all the actual work of formatting; The > format() met

Re: [Python-Dev] PEP 3102: Keyword-only arguments

2006-04-30 Thread Terry Reedy
""Martin v. Löwis"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Terry Reedy wrote: >>> Now, suppose you wanted to have 'key' be a keyword-only argument. >> >> Why? Why not let the user type the additional argument(s) without the >> parameter name? > > Are you asking why tha

Re: [Python-Dev] PEP 3102: Keyword-only arguments

2006-04-30 Thread Terry Reedy
"Nick Coghlan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Terry Reedy wrote: >> "Talin" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >>> Now, suppose you wanted to have 'key' be a keyword-only argument. >> >> Why? Why not let the user type the additional

Re: [Python-Dev] PEP 3102: Keyword-only arguments

2006-04-30 Thread Terry Reedy
> ""Martin v. Löwis"" <[EMAIL PROTECTED]> wrote in message >> Are you asking why that feature (keyword-only arguments) is desirable? Joe Smith asked essentially the same question in a different way: "However, I'm not sure what the use case is for keyword only arguments on functions that do *not*

[Python-Dev] unittest argv

2006-04-30 Thread John Keyes
Hi, main() in unittest has an optional parameter called argv. If it is not present in the invocation, it defaults to None. Later in the function a check is made to see if argv is None and if so sets it to sys.argv. I think the default should be changed to sys.argv[1:] (i.e. the command line argu

Re: [Python-Dev] More on contextlib - adding back a contextmanager decorator

2006-04-30 Thread Nick Coghlan
Guido van Rossum wrote: > On 4/30/06, Nick Coghlan <[EMAIL PROTECTED]> wrote: >> A few things from the pre-alpha2 context management terminology review >> have >> had a chance to run around in the back of my head for a while now, and >> I'd >> like to return to a topic Paul Moore brought up durin

Re: [Python-Dev] More on contextlib - adding back a contextmanager decorator

2006-04-30 Thread Guido van Rossum
> At 09:53 AM 4/30/2006 -0700, Guido van Rossum wrote: > >I have a counter-proposal: let's drop __context__. [...] > > with mycontext.some_method(prec_incr=2): > > On 4/30/06, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > But what's an appropriate name for some_method? Let's leave that up

Re: [Python-Dev] PEP 3102: Keyword-only arguments

2006-04-30 Thread Edward Loper
Terry Reedy wrote: > There are two subproposals: first, keyword-only args after a variable > number of positional args, which requires allowing keyword parameter > specifications after the *args parameter, and second, keyword-only args > after a fixed number number of positional args, implemente

Re: [Python-Dev] More on contextlib - adding back a contextmanager decorator

2006-04-30 Thread Guido van Rossum
[I'm cutting straight to the chase here] On 4/30/06, Nick Coghlan <[EMAIL PROTECTED]> wrote: > The downside of this over the __context__ method is that it is neither nesting > nor thread-safe. This argument is bogus. We currently have two types of objects involved in with-statements: those whose

Re: [Python-Dev] More on contextlib - adding back a contextmanager decorator

2006-04-30 Thread Phillip J. Eby
At 08:08 PM 4/30/2006 -0700, Guido van Rossum wrote: >If you object against the extra typing, we'll first laugh at you >(proposals that *only* shave a few characters of a common idiom aren't >all that popular in these parts), and then suggest that you can spell >foo.some_method() as foo(). Okay, y

Re: [Python-Dev] methods on the bytes object

2006-04-30 Thread Josiah Carlson
"Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > Josiah Carlson wrote: > >> I think what you are missing is that algorithms that currently operate > >> on byte strings should be reformulated to operate on character strings, > >> not reformulated to operate on bytes objects. > > > > By "character

Re: [Python-Dev] methods on the bytes object

2006-04-30 Thread Martin v. Löwis
Josiah Carlson wrote: >> I mean unicode strings, period. I can't imagine what "unicode strings >> which do not contain data" could be. > > Binary data as opposed to text. Input to a array.fromstring(), > struct.unpack(), etc. You can't/shouldn't put such data into character strings: you need an

Re: [Python-Dev] PEP 3102: Keyword-only arguments

2006-04-30 Thread Martin v. Löwis
Terry Reedy wrote: >> Are you asking why that feature (keyword-only arguments) is desirable? >> That's the whole point of the PEP. Or are you asking why the user >> shouldn't be allowed to pass keyword-only arguments by omitting the >> keyword? Because they wouldn't be keyword-only arguments then,

Re: [Python-Dev] PEP 3102: Keyword-only arguments

2006-04-30 Thread Martin v. Löwis
Terry Reedy wrote: Now, suppose you wanted to have 'key' be a keyword-only argument. >>> Why? Why not let the user type the additional argument(s) without the >>> parameter name? > > Like Martin, you clipped most of the essential context of my question: > Talin's second proposal. I cli

Re: [Python-Dev] Tkinter lockups.

2006-04-30 Thread Martin v. Löwis
Thomas Wouters wrote: > It seems that, on my platform at least, Tk_Init() doesn't like being > called twice even when the first call resulted in an error. That's Tcl > and Tk 8.4.12. Tkapp_Init() (which is the Tkinter part that calls > Tk_Init()) does its best to guard against calling Tk_Init() twi