Re: [Python-Dev] Unhashable objects and __contains__()

2006-06-04 Thread Georg Brandl
Collin Winter wrote: > On 6/4/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: >> On 6/3/06, Georg Brandl <[EMAIL PROTECTED]> wrote: >> > Collin Winter wrote: >> > > Idea: what if Python's -O option caused PySequence_Contains() to >> > > convert all errors into False return values? >> > >> > It woul

Re: [Python-Dev] Unhashable objects and __contains__()

2006-06-04 Thread Collin Winter
On 6/4/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 6/3/06, Georg Brandl <[EMAIL PROTECTED]> wrote: > > Collin Winter wrote: > > > Idea: what if Python's -O option caused PySequence_Contains() to > > > convert all errors into False return values? > > > > It would certainly give me an uneasy

Re: [Python-Dev] Unhashable objects and __contains__()

2006-06-03 Thread Guido van Rossum
On 6/3/06, Georg Brandl <[EMAIL PROTECTED]> wrote: > Collin Winter wrote: > > Idea: what if Python's -O option caused PySequence_Contains() to > > convert all errors into False return values? > > It would certainly give me an uneasy feeling if a command-line switch > caused such a change in semanti

Re: [Python-Dev] Unhashable objects and __contains__()

2006-06-03 Thread Guido van Rossum
On 6/3/06, Collin Winter <[EMAIL PROTECTED]> wrote: > My question is this: maybe set/frozenset.__contains__ (as well as > dict.__contains__, etc) should catch such TypeErrors and convert them > to a return value of False? It makes sense that "{} in frozenset([(1, > 2, 3])" should be False, since un

Re: [Python-Dev] Unhashable objects and __contains__()

2006-06-03 Thread Georg Brandl
Collin Winter wrote: > I recently submitted a patch that would optimise "in (5, 6, 7)" (ie, > "in" ops on constant tuples) to "in frozenset([5, 6, 7])". Raymond > Hettinger rejected (rightly) the patch since it's not semantically > consistent. Quoth: > >>> Sorry, this enticing idea has already bee

[Python-Dev] Unhashable objects and __contains__()

2006-06-03 Thread Collin Winter
I recently submitted a patch that would optimise "in (5, 6, 7)" (ie, "in" ops on constant tuples) to "in frozenset([5, 6, 7])". Raymond Hettinger rejected (rightly) the patch since it's not semantically consistent. Quoth: >> Sorry, this enticing idea has already been explored and >> rejected. Thi