Re: [Python-3000] Pre-PEP: Simple input built-in in Python 3000

2007-02-20 Thread Andre Roberge
Any possibility that (some of) the following can be done before Pycon? Respectfully yours, André Roberge On 12/23/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: [http://mail.python.org/pipermail/python-3000/2006-December/005257.html] > BTW, can someone clean up and check in the proto-PEP and star

Re: [Python-3000] [Python-ideas] immutable classes [was: pre-PEP: Default Argument Expressions]

2007-02-20 Thread Jan Kanis
On the 'using old semantics when you really want to' part, that's very well possible with a decorator under the proposed semantics: def caching(**cachevars): def inner(func): def wrapper(**argdict): for var in cachevars:

[Python-3000] Thoughts on dictionary views

2007-02-20 Thread Raymond Hettinger
The Java concept of dictionary views seems to have caught-on here while I wasn't looking. At the risk of covering some old ground, I would like to re-open the question. Here are a few thoughts on the subject to kick-off the discussion: * Maintaining a live (self-updating) view is a bit tricky

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Nick Coghlan
Raymond Hettinger wrote: > The Java concept of dictionary views seems to have caught-on here while I > wasn't > looking. At the risk of covering some old ground, I would like to re-open > the > question. Here are a few thoughts on the subject to kick-off the discussion: > > * Maintaining a l

Re: [Python-3000] [Python-ideas] immutable classes [was: pre-PEP: Default Argument Expressions]

2007-02-20 Thread Nick Coghlan
Jan Kanis wrote: I just hope if > python were designed today it would have done these. If Python had done these, it wouldn't be Python ;) There are many, many programming language design decisions which have good arguments on each side (and some which seem obviously correct may involve hidden

Re: [Python-3000] Pre-PEP: Simple input built-in in Python 3000

2007-02-20 Thread Nick Coghlan
Andre Roberge wrote: > Any possibility that (some of) the following can be done before Pycon? > Respectfully yours, > André Roberge I've added the PEP as 3111. I made a few small modifications (and committed it directly as Accepted) based on Guido's comments in this thread. The actual change sti

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Jason Orendorff
On 2/20/07, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > * A dict is also one of Python's most basic APIs (along with lists). Ideally, > we should keep those two APIs as simple as possible (getting rid of > setdefault() > and unneeded methods is a step in the right direction). IMO, the views w

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Steven Bethard
On 2/20/07, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > * ISTM that views offer three benefits: re-iterability, set behavior, and > self-updates. IMO, the first is not commonly needed and is trivially served > by > writing list(mydict.items()) or somesuch. The second is best served by an > e

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Paul Moore
On 20/02/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > On 2/20/07, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > My recommendation is to take a more conservative route. Let's make dicts as > > simple as possible and then introduce a new collections module entry with > > the > > views bells a

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Aahz
On Tue, Feb 20, 2007, Raymond Hettinger wrote: > > My recommendation is to take a more conservative route. Let's make > dicts as simple as possible and then introduce a new collections > module entry with the views bells and whistles. If the collections > version proves itself as enor

Re: [Python-3000] Pre-PEP: Simple input built-in in Python 3000

2007-02-20 Thread Guido van Rossum
Why do you want this *before* PyCon? It would be much easier to do this as part of the Py3k sprint. On 2/20/07, Nick Coghlan <[EMAIL PROTECTED]> wrote: > Andre Roberge wrote: > > Any possibility that (some of) the following can be done before Pycon? > > Respectfully yours, > > André Roberge > > I'

Re: [Python-3000] Pre-PEP: Simple input built-in in Python 3000

2007-02-20 Thread Guido van Rossum
Consider the PEP accepted. Regarding the conversion, please do use the sandbox/2to3 framework. Write me if you have trouble understanding the many examples already in fixes/. On 2/20/07, Andre Roberge <[EMAIL PROTECTED]> wrote: > On 2/20/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > Why do

Re: [Python-3000] Pre-PEP: Simple input built-in in Python 3000

2007-02-20 Thread Andre Roberge
On 2/20/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Why do you want this *before* PyCon? It would be much easier to do > this as part of the Py3k sprint. > My main interest was to have, prior to Pycon, the PEP recorded as such; it had been close to 2 months since the last post on this issue

Re: [Python-3000] Pre-PEP: Simple input built-in in Python 3000

2007-02-20 Thread Andre Roberge
On 2/20/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Why do you want this *before* PyCon? It would be much easier to do > this as part of the Py3k sprint. > My main interest was to have, prior to Pycon, the PEP recorded as such; it had been close to 2 months since the last post on this issue

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Greg Ewing
Raymond Hettinger wrote: > * Maintaining a live (self-updating) view is a bit tricky from an > implementation > point-of-view. I don't understand what the alternative is. If mutating the underlying object doesn't affect the view, then you don't really have a view, just a copy of the data -- no

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Guido van Rossum
On 2/20/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > Raymond Hettinger wrote: > > > * Maintaining a live (self-updating) view is a bit tricky from an > > implementation > > point-of-view. > > I don't understand what the alternative is. If mutating the > underlying object doesn't affect the view, th

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Guido van Rossum
On 2/20/07, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > The Java concept of dictionary views seems to have caught-on here while I > wasn't > looking. At the risk of covering some old ground, I would like to re-open the > question. Because it's coming from you I am reopening the discussion; di

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Guido van Rossum
On 2/20/07, Paul Moore <[EMAIL PROTECTED]> wrote: > (I have similar concerns over the "new IO" proposals I've > seen, but there's nothing concrete there yet, so I'll save that > argument for another day...) Then you should also have misgivings about the Unicode/str unification. If you are cool wit

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Guido van Rossum
On 2/20/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > Just to clarfiy, you're suggesting that we still change .keys() > .values() and .items() to iterators, right? But this isn't really easier to explain to noobs than views, is it? What's the advantage of >>> {}.keys() >>> over >>> {}.keys()

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Steven Bethard
On 2/20/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 2/20/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > > Just to clarfiy, you're suggesting that we still change .keys() > > .values() and .items() to iterators, right? > > But this isn't really easier to explain to noobs than views, is it?

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Guido van Rossum
On 2/20/07, Nick Coghlan <[EMAIL PROTECTED]> wrote: > Raymond Hettinger wrote: > > The Java concept of dictionary views seems to have caught-on here while I > > wasn't > > looking. At the risk of covering some old ground, I would like to re-open > > the > > question. Here are a few thoughts on

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Guido van Rossum
On 2/20/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > On 2/20/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > On 2/20/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > > > Just to clarfiy, you're suggesting that we still change .keys() > > > .values() and .items() to iterators, right? > > > > B

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Steven Bethard
On 2/20/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > Just to clarfiy, you're suggesting that we still change .keys() > .values() and .items() to iterators, right? On 2/20/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > But this isn't really easier to explain to noobs than views, is it? On 2/

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Delaney, Timothy (Tim)
Steven Bethard wrote: > The advantage is only in what you have to explain about the object. In > the former case, you can simply say "it's an iterator over the keys" > and they can understand it with their existing knowledge of iterators. "it's an iterator over the keys" They use their knowledge

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Guido van Rossum
On 2/20/07, Delaney, Timothy (Tim) <[EMAIL PROTECTED]> wrote: > Steven Bethard wrote: > > > The advantage is only in what you have to explain about the object. In > > the former case, you can simply say "it's an iterator over the keys" > > and they can understand it with their existing knowledge of

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Larry Hastings
Delaney, Timothy (Tim) wrote: > A view is a lightweight object that implements an interface by > delegating to an underlying object. The underlying object cannot be > changed through the view, but could be changed directly, in which case > the view will reflect the new contents of the object. It ce

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Delaney, Timothy (Tim)
Larry Hastings wrote: > Delaney, Timothy (Tim) wrote: >> A view is a lightweight object that implements an interface by >> delegating to an underlying object. The underlying object cannot be >> changed through the view, but could be changed directly, in which >> case the view will reflect the new

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Delaney, Timothy (Tim)
Guido van Rossum wrote: >> Note that some changes to the underlying object may invalidate the >> view, in which case using it will throw an exception. > > No, this only invalidates an in-progress iterator. Yeah - that's what I meant - just couldn't think if there were any other situations that m

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Josiah Carlson
(merging a few replies to reduce traffic) "Delaney, Timothy (Tim)" <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > You can also think of dict views as a straightforward application of > > the GoF adapter pattern. > > Yep - and I think that would be a good secondary explanation, instantl

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Josiah Carlson
"Guido van Rossum" <[EMAIL PROTECTED]> wrote: > On 2/20/07, Paul Moore <[EMAIL PROTECTED]> wrote: > > (I have similar concerns over the "new IO" proposals I've > > seen, but there's nothing concrete there yet, so I'll save that > > argument for another day...) > > Then you should also have misgiv

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Guido van Rossum
On 2/20/07, Josiah Carlson <[EMAIL PROTECTED]> wrote: > I was "eh, why bother?" prior to reading the updated PEP 3106, but now > can see the benefit to keys(), values(), and items() returning views. > I'm not sure I would use the added features (I don't believe I've ever > compared the equalities o

Re: [Python-3000] Thoughts on new I/O library and bytecode

2007-02-20 Thread Guido van Rossum
[Note: changed subject] On 2/20/07, Josiah Carlson <[EMAIL PROTECTED]> wrote: > > "Guido van Rossum" <[EMAIL PROTECTED]> wrote: > > On 2/20/07, Paul Moore <[EMAIL PROTECTED]> wrote: > > > (I have similar concerns over the "new IO" proposals I've > > > seen, but there's nothing concrete there yet,

Re: [Python-3000] Thoughts on new I/O library and bytecode

2007-02-20 Thread Josiah Carlson
"Guido van Rossum" <[EMAIL PROTECTED]> wrote: > [Note: changed subject] > On 2/20/07, Josiah Carlson <[EMAIL PROTECTED]> wrote: > > I'm not so sure. The return type on socket.recv and os.read could be > > changed to bytes (seemingly without much difficulty), > > Yes, that's the plan anyway. Bet

Re: [Python-3000] Thoughts on new I/O library and bytecode

2007-02-20 Thread Guido van Rossum
On 2/20/07, Josiah Carlson <[EMAIL PROTECTED]> wrote: > > "Guido van Rossum" <[EMAIL PROTECTED]> wrote: > > [Note: changed subject] > > On 2/20/07, Josiah Carlson <[EMAIL PROTECTED]> wrote: > > > I'm not so sure. The return type on socket.recv and os.read could be > > > changed to bytes (seemingly