Re: [Python-3000] Futures in Python 3000

2006-04-24 Thread Aurélien Campéas
On Fri, Apr 21, 2006 at 08:10:07PM +1200, Greg Ewing wrote: > Aurélien Campéas wrote: > > On Thu, Apr 20, 2006 at 07:59:43PM +1200, Greg Ewing wrote: > > > Andy Sy wrote: > > > > Does this mean that Py3K intends to reuse major portions of > > > > Python 2.x's implementation? > > > I expect that alm

[Python-3000] Unsure if I should write a PEP on Types

2006-04-24 Thread Bill Birch
The optional static typing blog http://www.artima.com/weblogs/viewpost.jsp?thread=87182 and many other postings imply a lot of interesting detail about types, type expression, type checking, adapt() and such. I'm considering collecting some of these subjects together in a note for review and p

Re: [Python-3000] [Python-3000-checkins] r45689 - in python/branches/p3yk: Include/bytesobject.h Lib/test/test_bytes.py Lib/test/test_file.py Objects/bytesobject.c Objects/fileobject.c

2006-04-24 Thread Thomas Wouters
On 4/24/06, guido.van.rossum wrote: +new->ob_size = size;+if (size == 0)+new->ob_bytes = NULL;+else {+new->ob_bytes = PyMem_Malloc(size);+if (new->ob_bytes == NULL) {+Py_DECREF(new); +return NULL;+

Re: [Python-3000] sets in P3K?

2006-04-24 Thread Greg Wilson
Hi Guido, > On 4/24/06, Greg Wilson <[EMAIL PROTECTED]> wrote: > > On a completely different note, are you willing to consider native > > syntax for sets (as per PEP 218) in Python 3000? > I like to write {1, 2, 3} instead of set([1, 2, 3]) but I don't know > what to do with the ambiguity for {}.

Re: [Python-3000] sets in P3K?

2006-04-24 Thread Barry Warsaw
On Mon, 2006-04-24 at 10:16 -0400, Greg Wilson wrote: > I'm sure we can work something out --- I agree, {} for empty set and {:} > for empty dict would be ideal, were it not for backward compatibility. I dunno, the more I write dict() and set() the more I kind of like them rather the literal alte

Re: [Python-3000] sets in P3K?

2006-04-24 Thread Guido van Rossum
On 4/24/06, Greg Wilson <[EMAIL PROTECTED]> wrote: > Would getting a > trial implementation done on top of P2.5 be a good Google Summer of Code > project? Mmm, seems a rather small project to me to spend a whole summer... -- --Guido van Rossum (home page: http://www.python.org/~guido/) __

Re: [Python-3000] Brainstorming: Python Metaprogramming

2006-04-24 Thread Ian Bicking
Talin wrote: > It seems that the history of the Python mailing lists are littered with the > decayed corpses of various ideas related to "metaprogramming", that is, > programs > that write programs, either at compile time. > > We've seen proposals for C-style macros, Lisp-style macros, programmab

[Python-3000] Changing order of class creation

2006-04-24 Thread Ian Bicking
Here's something for the crazy idea bin... Right now class creation looks like: class X(base): y = 'z' This gets the things in the () (object), evaluates the body of the class in a new scope and captures that scope (namespace), and looks for a metaclass using a couple rules. Then it

Re: [Python-3000] Minor hitch writing the Function Signature PEP

2006-04-24 Thread Jim Jewett
On 4/23/06, Talin <[EMAIL PROTECTED]> wrote: >... you can't just do it for a single argument in isolation. You > have no idea where any positional argument is going to > go until all keyword arguments have been placed, and > until all previous positional arguments have > been placed. Yes you do.

Re: [Python-3000] sets in P3K?

2006-04-24 Thread Alex Martelli
On 4/24/06, Barry Warsaw <[EMAIL PROTECTED]> wrote: > On Mon, 2006-04-24 at 10:16 -0400, Greg Wilson wrote: > > > I'm sure we can work something out --- I agree, {} for empty set and {:} > > for empty dict would be ideal, were it not for backward compatibility. > > I dunno, the more I write dict()

Re: [Python-3000] PEP - string.format

2006-04-24 Thread Jim Jewett
On 4/22/06, Nick Coghlan <[EMAIL PROTECTED]> wrote: > Talin wrote: > > 2) Otherwise, see if the value to be formatted has a __format__ method. If > > it does, then call it. > So an object can override standard parsing like {0:d} to return something > other than an integer? *shudder* There are s

Re: [Python-3000] Open Issues for string.format PEP

2006-04-24 Thread Ian Bicking
Talin wrote: >>>4) Should there be a way to pass in a dict argument without flattening it via >>>**args? >> >>I think it might not be ambiguous in practice if the first argument >>could be a dictionary. Because you get: >> >> "{foo}".format(a_dict) >> >>Since 'foo' isn't an integer and *no* key

[Python-3000] Adding sorting to generator comprehension

2006-04-24 Thread Ian Bicking
In another thread ("Brainstorming: Python Metaprogramming") it occurred to me that many LINQish things are reasonable enough given the AST and generator expressinos. But sorting is hard to do. Sorting also remains a place where lambdas are still frequently needed, like: sorted(list_of_peop

Re: [Python-3000] Changing order of class creation

2006-04-24 Thread Alex Martelli
On 4/24/06, Ian Bicking <[EMAIL PROTECTED]> wrote: > Here's something for the crazy idea bin... > > Right now class creation looks like: > >class X(base): >y = 'z' > > This gets the things in the () (object), evaluates the body of the class > in a new scope and captures that scope (name

Re: [Python-3000] Changing order of class creation

2006-04-24 Thread Jack Diederich
On Mon, Apr 24, 2006 at 10:53:39AM -0500, Ian Bicking wrote: > Here's something for the crazy idea bin... > > Right now class creation looks like: > >class X(base): >y = 'z' > > This gets the things in the () (object), evaluates the body of the class > in a new scope and captures th

Re: [Python-3000] Stackable Blocks

2006-04-24 Thread Jim Jewett
On 4/23/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > ... the normal Python rule is that if you have a full-colon > (ANYWHERE), and you put something after it on the > same line, then you're done the block. That would already be a slight improvement, from my perspective. Today, being done is requi

Re: [Python-3000] sets in P3K?

2006-04-24 Thread Alex Martelli
On 4/24/06, Greg Wilson <[EMAIL PROTECTED]> wrote: > Interesting --- I think that being able to write down a data structure > using the same sort of notation you'd use on a whiteboard in a high school > math class is one of the great strengths of scripting languages, and one > of the things that ma

Re: [Python-3000] symbols?

2006-04-24 Thread Jim Jewett
On 4/18/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 4/18/06, Jim Jewett <[EMAIL PROTECTED]> wrote: > Do you realize that you are > describing that the expression > .foo > is syntactic sugar for > > lambda self: self._foo() Somehow I had it in my head that I needed to also call t

Re: [Python-3000] sets in P3K?

2006-04-24 Thread Greg Wilson
Interesting --- I think that being able to write down a data structure using the same sort of notation you'd use on a whiteboard in a high school math class is one of the great strengths of scripting languages, and one of the things that makes it possible to use Python, Perl, and Ruby as configurat

Re: [Python-3000] Adding sorting to generator comprehension

2006-04-24 Thread Josiah Carlson
Ian Bicking <[EMAIL PROTECTED]> wrote: > > In another thread ("Brainstorming: Python Metaprogramming") it occurred > to me that many LINQish things are reasonable enough given the AST and > generator expressinos. But sorting is hard to do. Sorting also remains > a place where lambdas are sti

Re: [Python-3000] Unsure if I should write a PEP on Types

2006-04-24 Thread skip
Bill> Has a PEP already been written? Would this be useful? Who else Bill> finds this interesting or may have started on these subjects? Bill> OK, so I'm fishing for encouragement here. ;-) To very loosely paraphrase the late (some would say great) Johnny Cochran: When in do

Re: [Python-3000] Open Issues for string.format PEP

2006-04-24 Thread Jim Jewett
On 4/22/06, Talin <[EMAIL PROTECTED]> wrote: > Here's a condensed list of the open issues that have been raised by people > so far: I'm not sure whether this was raised explicitly, but Ian at least mentioned it: Are they keys to the dictionary in some way restricted? For instance, I think it wou

Re: [Python-3000] sets in P3K?

2006-04-24 Thread Ian Bicking
Greg Wilson wrote: > Interesting --- I think that being able to write down a data structure > using the same sort of notation you'd use on a whiteboard in a high school > math class is one of the great strengths of scripting languages, and one > of the things that makes it possible to use Python, P

Re: [Python-3000] Open Issues for string.format PEP

2006-04-24 Thread Talin
Jim Jewett gmail.com> writes: > > On 4/22/06, Talin acm.org> wrote: > > Here's a condensed list of the open issues that have been raised by people > > so far: > > I'm not sure whether this was raised explicitly, but Ian at least > mentioned it: Are they keys to the dictionary in some way rest

Re: [Python-3000] sets in P3K?

2006-04-24 Thread Guido van Rossum
On 4/24/06, Alex Martelli <[EMAIL PROTECTED]> wrote: > On 4/24/06, Greg Wilson <[EMAIL PROTECTED]> wrote: > > Interesting --- I think that being able to write down a data structure > > using the same sort of notation you'd use on a whiteboard in a high school > > math class is one of the great stre

Re: [Python-3000] Adding sorting to generator comprehension

2006-04-24 Thread Ian Bicking
Josiah Carlson wrote: > One of the features of generator expressions which makes it desireable > instead of list comprehensions is that generator expressions may use > less memory *now*, and may be able to start returning results *now*. > > Using ( orderby ...) as a replacement for sorted((genexp)

Re: [Python-3000] Open Issues for string.format PEP

2006-04-24 Thread Ian Bicking
Talin wrote: >>>Here's a condensed list of the open issues that have been raised by people >>>so far: >> >>I'm not sure whether this was raised explicitly, but Ian at least >>mentioned it: Are they keys to the dictionary in some way restricted? >> >>For instance, I think it would be reasonable to

Re: [Python-3000] sets in P3K?

2006-04-24 Thread Alex Martelli
On 4/24/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 4/24/06, Alex Martelli <[EMAIL PROTECTED]> wrote: > > On 4/24/06, Greg Wilson <[EMAIL PROTECTED]> wrote: > > > Interesting --- I think that being able to write down a data structure > > > using the same sort of notation you'd use on a whi

Re: [Python-3000] sets in P3K?

2006-04-24 Thread Guido van Rossum
On 4/24/06, Alex Martelli <[EMAIL PROTECTED]> wrote: > I dislike that as much as I dislike [] as a shorthand for > list(), but I have no trouble admitting that if we have the > [...] form, it's consistent to have the {...} one too. I think you're atypical in that dislike. -- --Guido van Rossum (h

Re: [Python-3000] [Python-3000-checkins] r45689 - in python/branches/p3yk: Include/bytesobject.h Lib/test/test_bytes.py Lib/test/test_file.py Objects/bytesobject.c Objects/fileobject.c

2006-04-24 Thread Guido van Rossum
On 4/24/06, Thomas Wouters <[EMAIL PROTECTED]> wrote: > > On 4/24/06, guido.van.rossum wrote: > > +new->ob_size = size; > > +if (size == 0) > +new->ob_bytes = NULL; > +else { > +new->ob_bytes = PyMem_Malloc(size); > +if (new->ob_bytes == NULL) { > +P

Re: [Python-3000] [Python-3000-checkins] r45689 - in python/branches/p3yk: Include/bytesobject.h Lib/test/test_bytes.py Lib/test/test_file.py Objects/bytesobject.c Objects/fileobject.c

2006-04-24 Thread Barry Warsaw
On Mon, 2006-04-24 at 11:18 -0700, Guido van Rossum wrote: > > Hmmm... Should we see this as official confirmation that PEP 7 is going to > > go to 4-space indents instead of tab ones, or is it just an editor > > accidentily left in Google-indent mode? (I think I prefer the former ;) > > The form

Re: [Python-3000] [Python-3000-checkins] r45689 - in python/branches/p3yk: Include/bytesobject.h Lib/test/test_bytes.py Lib/test/test_file.py Objects/bytesobject.c Objects/fileobject.c

2006-04-24 Thread Barry Warsaw
On Mon, 2006-04-24 at 11:18 -0700, Guido van Rossum wrote: > The former. I thought it was already decided? Of course, only for > *new* code so far, to ease merges. Here's a tiny bit of Emacs Lisp that should support the py3k style. Only moderately tested in XEmacs 21.5. -Barry (defconst py3k-st

Re: [Python-3000] [Python-3000-checkins] r45689 - in python/branches/p3yk: Include/bytesobject.h Lib/test/test_bytes.py Lib/test/test_file.py Objects/bytesobject.c Objects/fileobject.c

2006-04-24 Thread Guido van Rossum
On 4/24/06, Barry Warsaw <[EMAIL PROTECTED]> wrote: > On Mon, 2006-04-24 at 11:18 -0700, Guido van Rossum wrote: > > > > Hmmm... Should we see this as official confirmation that PEP 7 is going to > > > go to 4-space indents instead of tab ones, or is it just an editor > > > accidentily left in Goog

Re: [Python-3000] [Python-3000-checkins] r45689 - in python/branches/p3yk: Include/bytesobject.h Lib/test/test_bytes.py Lib/test/test_file.py Objects/bytesobject.c Objects/fileobject.c

2006-04-24 Thread Barry Warsaw
On Mon, 2006-04-24 at 11:44 -0700, Guido van Rossum wrote: > Doesn't have to be a flag day -- we can reformat code > opportunistically whenever there's no hope of ever doing merges from > 2.x. > > I do plan that within one file we'll stick to style consistency. Sounds good to me. I guess when s

Re: [Python-3000] Adding sorting to generator comprehension

2006-04-24 Thread Josiah Carlson
Ian Bicking <[EMAIL PROTECTED]> wrote: > > Josiah Carlson wrote: > > One of the features of generator expressions which makes it desireable > > instead of list comprehensions is that generator expressions may use > > less memory *now*, and may be able to start returning results *now*. > > > > Us

Re: [Python-3000] [Python-3000-checkins] r45689 - in python/branches/p3yk: Include/bytesobject.h Lib/test/test_bytes.py Lib/test/test_file.py Objects/bytesobject.c Objects/fileobject.c

2006-04-24 Thread skip
Barry> Sounds good to me. I guess when someone is about to do Barry> significant work on a C file, we should ask on this list about Barry> that possibility, and if it's low, then we can reformat the file Barry> at that time. I presume with the reformatting happening in a separate

Re: [Python-3000] Open Issues for string.format PEP

2006-04-24 Thread Talin
Ian Bicking colorstudy.com> writes: > > Talin wrote: > >>>Here's a condensed list of the open issues that have been raised by people > >>>so far: > >> > >>I'm not sure whether this was raised explicitly, but Ian at least > >>mentioned it: Are they keys to the dictionary in some way restricted?

Re: [Python-3000] sets in P3K?

2006-04-24 Thread Terry Reedy
"Guido van Rossum" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 4/24/06, Alex Martelli <[EMAIL PROTECTED]> wrote: >> I dislike that as much as I dislike [] as a shorthand for >> list(), but I have no trouble admitting that if we have the >> [...] form, it's consistent to have

Re: [Python-3000] rough draft signature PEP

2006-04-24 Thread Brett Cannon
On 4/22/06, Talin <[EMAIL PROTECTED]> wrote: > Brett Cannon python.org> writes: > > > [I am posting to python-3000 since this is where the parameter list > > ideas are being discussed, but this is probably generic enough to > > eventually make it into the 2.x line] > > > > Here is a rough draft of

Re: [Python-3000] Changing order of class creation

2006-04-24 Thread Terry Reedy
"Ian Bicking" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] metaclass using a couple rules. Then it does: > > X = metaclass('X', (base,), {'y': 'z'}) > > What if instead it did: > > X = metaclass('X', (base,)) > X.y = 'z' What if X is inmutable, or intended to be so, either

Re: [Python-3000] sets in P3K?

2006-04-24 Thread Steven Bethard
Guido van Rossum wrote: > OTOH mathematicians (whether in high school or not) write things like > {x | 2 < x < 10}, which is of course the origin of our list > comprehensions and generator expressions. Therefor I think it makes > sense that {F(x) for x in S if P(x)}, ough to be valid syntax if we >

Re: [Python-3000] sets in P3K?

2006-04-24 Thread Raymond Hettinger
Greg Wilson wrote: >I'm sure we can work something out --- I agree, {} for empty set and {:} >for empty dict would be ideal, were it not for backward compatibility. > For the record, I am strong -1 on adding a custom syntax for sets. IMO, most of the interesting uses of sets start with some ext

Re: [Python-3000] sets in P3K?

2006-04-24 Thread Steven Bethard
On 4/24/06, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > Greg Wilson wrote: > > >I'm sure we can work something out --- I agree, {} for empty set and {:} > >for empty dict would be ideal, were it not for backward compatibility. > > [snip] > Further, punctuation approaches face uncomfortable choic

[Python-3000] PEP3100 update: chained exceptions

2006-04-24 Thread Aahz
The recent discussion about the with statement on python-dev reminded me that at one point we talked about making chained exceptions automatic. Could someone update PEP3100 to list chained exceptions as one of the features that needs discussion? -- Aahz ([EMAIL PROTECTED]) <*> ht

Re: [Python-3000] PEP3100 update: chained exceptions

2006-04-24 Thread Guido van Rossum
On 4/24/06, Aahz <[EMAIL PROTECTED]> wrote: > The recent discussion about the with statement on python-dev reminded me > that at one point we talked about making chained exceptions automatic. > Could someone update PEP3100 to list chained exceptions as one of the > features that needs discussion?

Re: [Python-3000] Unsure if I should write a PEP on Types

2006-04-24 Thread Bill Birch
You wrote: >Bill> Has a PEP already been written? Would this be useful? Who else > Bill> finds this interesting or may have started on these subjects? > Bill> OK, so I'm fishing for encouragement here. ;-) > >To very loosely paraphrase the late (some would say great) Johnny Cochran: > >

Re: [Python-3000] sets in P3K?

2006-04-24 Thread Greg Wilson
> Ian Bicking: > Instead you get set([2, 3, 5, 7]), which is much less attractive and > introduces an unneeded intermediate data structure. Or set((2, 3, 5, > 7))... which is typographically prettier, but probably more confusing to > a newbie. > > Generator comprehensions + dict() were a nice alte

Re: [Python-3000] sets in P3K?

2006-04-24 Thread Greg Wilson
> > Guido: > > sense that {F(x) for x in S if P(x)}, ough to be valid syntax if we > > support {1, 2, 3} -- IOW the form {} should mean the same as > > set(). > Alex: > I dislike that as much as I dislike [] as a shorthand for > list(), but I have no trouble admitting that if we have the > [...] f

Re: [Python-3000] sets in P3K?

2006-04-24 Thread Alex Martelli
On Apr 24, 2006, at 6:35 PM, Greg Wilson wrote: >> Ian Bicking: >> Instead you get set([2, 3, 5, 7]), which is much less attractive and >> introduces an unneeded intermediate data structure. Or set((2, 3, 5, >> 7))... which is typographically prettier, but probably more >> confusing to >> a ne

[Python-3000] Give power to __getattr__

2006-04-24 Thread Kay Schluehr
While observing heated discussions about adaption and generic functions I wonder if this is a good opportunity for a modest complaint about the castration of __getattr__ in new style classes. What are you doing if you want to adapt a new style class X to a class that has implemented e.g. __add__

Re: [Python-3000] Give power to __getattr__

2006-04-24 Thread Nick Coghlan
Kay Schluehr wrote: > While observing heated discussions about adaption and generic functions > I wonder if this > is a good opportunity for a modest complaint about the castration of > __getattr__ in new style classes. If you want to get full control back, that's what __getattribute__ is for. .