Re: [Python-Dev] PEP 351 - do while

2006-10-01 Thread Ron Adam
Michael Urman wrote: > On 10/1/06, Ron Adam <[EMAIL PROTECTED]> wrote: >> (I don't think this has been suggested yet.) >> >> while , : >> > > [snip] > >> Putting both the entry and exit conditions at the top is easier to read. > > I agree in principle, but I thought the proposed sy

Re: [Python-Dev] PEP 351 - do while

2006-10-01 Thread Andrew Koenig
> This pattern: > > while entry_cond: > ... > and while not exit_cond: > ... > > has been suggested before, and I believe that at least one of the times it > was suggested, it had some support from Guido. Essentially, the "and > while not exit" is equivalent to an "

Re: [Python-Dev] PEP 351 - do while

2006-10-01 Thread Phillip J. Eby
At 12:58 PM 10/1/2006 -0400, Andrew Koenig wrote: > > (I don't think this has been suggested yet.) > > > > while , : > > > >This usage makes me uneasy, not the least because I don't understand why the >comma isn't creating a tuple. That is, why whould > > while x, y: >

Re: [Python-Dev] PEP 351 - do while

2006-10-01 Thread Andrew Koenig
> (I don't think this has been suggested yet.) > > while , : > This usage makes me uneasy, not the least because I don't understand why the comma isn't creating a tuple. That is, why whould while x, y: be any different from while (x, y):

Re: [Python-Dev] PEP 351 - do while

2006-10-01 Thread Michael Urman
On 10/1/06, Ron Adam <[EMAIL PROTECTED]> wrote: > (I don't think this has been suggested yet.) > > while , : > [snip] > Putting both the entry and exit conditions at the top is easier to read. I agree in principle, but I thought the proposed syntax already has meaning today (as it

Re: [Python-Dev] PEP 351 - do while

2006-10-01 Thread Ron Adam
Nick Coghlan wrote: > Hans Polak wrote: >> Hi, >> >> >> >> Just an opinion, but many uses of the ‘while true loop’ are instances of >> a ‘do loop’. I appreciate the language layout question, so I’ll give you >> an alternative: >> >> >> >> do: >> >> >> >> >> >>

Re: [Python-Dev] PEP 351 - do while

2006-09-30 Thread Nick Coghlan
Hans Polak wrote: > Hi, > > > > Just an opinion, but many uses of the ‘while true loop’ are instances of > a ‘do loop’. I appreciate the language layout question, so I’ll give you > an alternative: > > > > do: > > > > > > while > I believe you m

[Python-Dev] PEP 351 - do while

2006-09-30 Thread Hans Polak
Hi,   Just an opinion, but many uses of the ‘while true loop’ are instances of a ‘do loop’. I appreciate the language layout question, so I’ll give you an alternative:   do:             while   Cheers, Hans Polak.   This message contains informat

Re: [Python-Dev] PEP 351

2006-02-13 Thread Guido van Rossum
I've rejected PEP 351, with a reference to this thread as the rationale. -- --Guido van Rossum (home page: http://www.python.org/~guido/) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: h

Re: [Python-Dev] PEP 351

2006-02-12 Thread Greg Ewing
Bengt Richter wrote: > Anyhow, why shouldn't you be able to call freeze(an_ordinary_list) and get > back freeze(xlist(an_ordinary_list)) > automatically, based e.g. on a freeze_registry_dict[type(an_ordinary_list)] > => xlist lookup, if plain hash fails? [Cue: sound of loud alarm bells going of

Re: [Python-Dev] PEP 351

2006-02-11 Thread Bengt Richter
On Sat, 11 Feb 2006 12:55:10 -0800, Alex Martelli <[EMAIL PROTECTED]> wrote: > >On Feb 10, 2006, at 1:05 PM, Raymond Hettinger wrote: > >> [Guido van Rossum] >>> PEP 351 - freeze protocol. I'm personally -1; I don't like the >>> idea of >>> freezing arbitrary mutable data structures. Are there c

Re: [Python-Dev] PEP 351

2006-02-11 Thread Raymond Hettinger
[Noam] > I just wanted to say this: you can reject PEP 351, please don't reject > the idea of frozen objects completely. I'm working on an idea similar > to that of the PEP, . . . > I think these concerns can only be judged given a real suggestion, > along with an implementation. I have already im

Re: [Python-Dev] PEP 351

2006-02-11 Thread Noam Raphael
Hello, I just wanted to say this: you can reject PEP 351, please don't reject the idea of frozen objects completely. I'm working on an idea similar to that of the PEP, and I think that it can be done elegantly, without the concrete problems that Raymond pointed. I didn't work on it in the last few

Re: [Python-Dev] PEP 351

2006-02-11 Thread Raymond Hettinger
- Original Message - From: "Alex Martelli" <[EMAIL PROTECTED]> To: "Raymond Hettinger" <[EMAIL PROTECTED]> Cc: Sent: Saturday, February 11, 2006 3:55 PM Subject: PEP 351 > > On Feb 10, 2006, at 1:05 PM, Raymond Hettinger wrote: > >> [Guido van Rossum] >>> PEP 351 - freeze protocol. I'm

Re: [Python-Dev] PEP 351

2006-02-11 Thread Barry Warsaw
On Feb 11, 2006, at 3:55 PM, Alex Martelli wrote: > > On Feb 10, 2006, at 1:05 PM, Raymond Hettinger wrote: > >> [Guido van Rossum] >>> PEP 351 - freeze protocol. I'm personally -1; I don't like the >>> idea of >>> freezing arbitrary mutable data structures. Are there champions who >>> want to arg

[Python-Dev] PEP 351

2006-02-11 Thread Alex Martelli
On Feb 10, 2006, at 1:05 PM, Raymond Hettinger wrote: > [Guido van Rossum] >> PEP 351 - freeze protocol. I'm personally -1; I don't like the >> idea of >> freezing arbitrary mutable data structures. Are there champions who >> want to argue this? > > It has at least one anti-champion. I think i

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-31 Thread Noam Raphael
I thought about something - > > I think that the performance penalty may be rather small - remember > that in programs which do not change strings, there would never be a > need to copy the string data at all. And since I think that usually > most of the dict lookups are for method or function name

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-31 Thread Noam Raphael
On 10/31/05, Josiah Carlson <[EMAIL PROTECTED]> wrote: ... > And I'm going to point out why you are wrong. I still don't think so. I think that I need to reclarify what I mean. > > About the users-changing-my-internal-data issue: ... > You can have a printout before it dies: > "I'm crashing your

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-31 Thread Josiah Carlson
Noam Raphael <[EMAIL PROTECTED]> wrote: > Hello, > > I have slept quite well, and talked about it with a few people, and I > still think I'm right. And I'm going to point out why you are wrong. > About the users-changing-my-internal-data issue: > > > Again, user semantics. Tell your users not

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-31 Thread Josiah Carlson
Steve Holden <[EMAIL PROTECTED]> wrote: > > Josiah Carlson wrote: > [...] > >>Perhaps I didn't make it clear. The difference between wxPython's Grid > >>and my table is that in the table, most values are *computed*. This > >>means that there's no point in changing the values themselves. They > >>

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-31 Thread Noam Raphael
Hello, I have slept quite well, and talked about it with a few people, and I still think I'm right. About the users-changing-my-internal-data issue: > Again, user semantics. Tell your users not to modify entries, and/or > you can make copies of objects you return. If your users are too daft >

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-31 Thread Oren Tirosh
On 10/31/05, Antoine Pitrou <[EMAIL PROTECTED]> wrote: > > > It allows everything in Python to be both mutable and hashable, > > I don't understand, since it's already the case. Any user-defined object > is at the same time mutable and hashable. By default, user-defined objects are equal iff they

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-31 Thread Steve Holden
Josiah Carlson wrote: [...] >>Perhaps I didn't make it clear. The difference between wxPython's Grid >>and my table is that in the table, most values are *computed*. This >>means that there's no point in changing the values themselves. They >>are also used frequently as set members (I can describe

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-30 Thread Josiah Carlson
Noam Raphael <[EMAIL PROTECTED]> wrote: > > Hello, > > It seems that we both agree that freezing is cool (-; . We disagree on > whether a copy-on-write behaviour is desired. Your arguments agains > copy-on-write are: > 1. It's not needed. > 2. It's complicated to implement. > > But first of all

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-30 Thread Antoine Pitrou
> It allows everything in Python to be both mutable and hashable, I don't understand, since it's already the case. Any user-defined object is at the same time mutable and hashable. And if you want the hash value to follow the changes in attribute values, just define an appropriate __hash__ method

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-30 Thread Noam Raphael
Hello, It seems that we both agree that freezing is cool (-; . We disagree on whether a copy-on-write behaviour is desired. Your arguments agains copy-on-write are: 1. It's not needed. 2. It's complicated to implement. But first of all, you didn't like my use cases. I want to argue with that. >

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-29 Thread Josiah Carlson
Noam Raphael <[EMAIL PROTECTED]> wrote: > > Hello, > > I have thought about freezing for some time, and I think that it is a > fundamental need - the need to know, sometimes, that objects aren't > going to change. I agree with this point. > This is mostly the need of containers. dicts need to

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-29 Thread Noam Raphael
Hello, I have thought about freezing for some time, and I think that it is a fundamental need - the need to know, sometimes, that objects aren't going to change. This is mostly the need of containers. dicts need to know that the objects that are used as keys aren't going to change, because if the

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-26 Thread Paolino
Paolino wrote: > Is __hash__=id inside a class enough to use a set (sets.Set before 2.5) > derived class instance as a key to a mapping? It is __hash__=lambda self:id(self) that is terribly slow ,it needs a faster way to state that to let them be useful as key to mapping as all set operations w

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-25 Thread Josiah Carlson
Nick Coghlan <[EMAIL PROTECTED]> wrote: > > Josiah Carlson wrote: > > Nick Coghlan <[EMAIL PROTECTED]> wrote: > >> I think having dicts and sets automatically invoke freeze would be a > >> mistake, > >> because at least one of the following two cases would behave unexpectedly: > > > > I'm pret

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-25 Thread Nick Coghlan
Josiah Carlson wrote: > Nick Coghlan <[EMAIL PROTECTED]> wrote: >> I think having dicts and sets automatically invoke freeze would be a >> mistake, >> because at least one of the following two cases would behave unexpectedly: > > I'm pretty sure that the PEP was only aslomg if one would freeze t

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-24 Thread Raymond Hettinger
[Barry Warsaw] > I've had this PEP laying around for quite a few months. It was inspired > by some code we'd written which wanted to be able to get immutable > versions of arbitrary objects. * FWIW, the _as_immutable() protocol was dropped from sets.py for a reason. User reports indicated that

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-24 Thread Gary Poster
On Oct 23, 2005, at 6:43 PM, Barry Warsaw wrote: > I've had this PEP laying around for quite a few months. It was > inspired > by some code we'd written which wanted to be able to get immutable > versions of arbitrary objects. I've finally finished the PEP, > uploaded > a sample patch (albe

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-24 Thread Paolino
I'm not sure I understood completely the idea but deriving freeze function from hash gives hash a wider importance. Is __hash__=id inside a class enough to use a set (sets.Set before 2.5) derived class instance as a key to a mapping? Sure I missed the point. Regards Paolino ___

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-24 Thread Josiah Carlson
Nick Coghlan <[EMAIL PROTECTED]> wrote: > I think having dicts and sets automatically invoke freeze would be a mistake, > because at least one of the following two cases would behave unexpectedly: I'm pretty sure that the PEP was only aslomg if one would freeze the contents of dicts IF the dict

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-24 Thread Josiah Carlson
Christopher Armstrong <[EMAIL PROTECTED]> wrote: > > On 10/24/05, Josiah Carlson <[EMAIL PROTECTED]> wrote: > > "Should dicts and sets automatically freeze their mutable keys?" > > > > Dictionaries don't have mutable keys, > > Since when? > > Maybe you meant something else? I can't think of any

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-24 Thread Christopher Armstrong
On 10/24/05, Josiah Carlson <[EMAIL PROTECTED]> wrote: > "Should dicts and sets automatically freeze their mutable keys?" > > Dictionaries don't have mutable keys, Since when? class Foo: def __init__(self): self.x = 1 f = Foo() d = {f: 1} f.x = 2 Maybe you meant something else? I ca

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-24 Thread Nick Coghlan
Barry Warsaw wrote: > I've had this PEP laying around for quite a few months. It was inspired > by some code we'd written which wanted to be able to get immutable > versions of arbitrary objects. I've finally finished the PEP, uploaded > a sample patch (albeit a bit incomplete), and I'm posting i

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-23 Thread Josiah Carlson
Barry Warsaw <[EMAIL PROTECTED]> wrote: > I've had this PEP laying around for quite a few months. It was inspired > by some code we'd written which wanted to be able to get immutable > versions of arbitrary objects. I've finally finished the PEP, uploaded > a sample patch (albeit a bit incomplet

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-23 Thread Adam Olsen
On 10/23/05, Barry Warsaw <[EMAIL PROTECTED]> wrote: > I've had this PEP laying around for quite a few months. It was inspired > by some code we'd written which wanted to be able to get immutable > versions of arbitrary objects. I've finally finished the PEP, uploaded > a sample patch (albeit a b

[Python-Dev] PEP 351, the freeze protocol

2005-10-23 Thread Barry Warsaw
I've had this PEP laying around for quite a few months. It was inspired by some code we'd written which wanted to be able to get immutable versions of arbitrary objects. I've finally finished the PEP, uploaded a sample patch (albeit a bit incomplete), and I'm posting it here to see if there is an