Re: [Python-Dev] A Horrible Inconsistency

2006-05-27 Thread Aahz
On Fri, May 26, 2006, Fredrik Lundh wrote: > > and while we're at it, let's fix this: > > >>> 0.66 * (1, 2, 3) > (1, 2) > > and maybe even this > > >>> 0.5 * (1, 2, 3) > (1, 1) > > but I guess the latter one might need a pronunciation. This should certainly get fixed in 3.0

Re: [Python-Dev] A Horrible Inconsistency

2006-05-26 Thread Jason Orendorff
On 5/26/06, Facundo Batista <[EMAIL PROTECTED]> wrote: > I think that we can do one of the following, when we found "-1 * (1, 2, 3)": > > - Treat -1 as 0 and return an empty tuple (actual behavior). > - Treat the negative as a reverser, so we get back (3, 2, 1). > - Raise an error. No, no, no. Th

Re: [Python-Dev] A Horrible Inconsistency

2006-05-26 Thread Facundo Batista
2006/5/26, Steven Bethard <[EMAIL PROTECTED]>: > On 5/26/06, Facundo Batista <[EMAIL PROTECTED]> wrote: > > All this different ways enforce my vote: we should get an error... > ... > But if this change goes in, I want a big "we're breaking backwards > incompatibility" message somewhere. I say

Re: [Python-Dev] A Horrible Inconsistency

2006-05-26 Thread Steven Bethard
On 5/26/06, Facundo Batista <[EMAIL PROTECTED]> wrote: > All this different ways enforce my vote: we should get an error... Perhaps you missed Tim's post, so here's a few lines of my own code that I know would break: padding = [None] * (self.width - len(leaves)) left_padding = [None]

Re: [Python-Dev] A Horrible Inconsistency

2006-05-26 Thread Facundo Batista
2006/5/26, Fred L. Drake, Jr. <[EMAIL PROTECTED]>: > Even better: > > "123"*-1 > > We'd get to explain: > > - what the "*-" operator is all about, and > > - why we'd use it with a string and an int. > > I see possibilities here. :-) All this different ways enforce my vote: we should get

Re: [Python-Dev] A Horrible Inconsistency

2006-05-26 Thread Fredrik Lundh
Fred L. Drake, Jr. wrote: > Even better: > > "123"*-1 > > We'd get to explain: > > - what the "*-" operator is all about, and > > - why we'd use it with a string and an int. > > I see possibilities here. :-) the infamous "*-" clear operator? who snuck that one into python? _

Re: [Python-Dev] A Horrible Inconsistency

2006-05-26 Thread skip
Fred> I see possibilities here. :-) Fred appears to be looking for more job security. ;-) Skip ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/option

Re: [Python-Dev] A Horrible Inconsistency

2006-05-26 Thread Georg Brandl
Fredrik Lundh wrote: > Sean Reifschneider wrote: > >>> - Treat the negative as a reverser, so we get back (3, 2, 1). >> >> Then we could get: >> >>>>> print -123 >>321 >> >> Yay! > > and while we're at it, let's fix this: > > >>> 0.66 * (1, 2, 3) > (1, 2) > > and maybe even

Re: [Python-Dev] A Horrible Inconsistency

2006-05-26 Thread Fred L. Drake, Jr.
On Friday 26 May 2006 11:50, Georg Brandl wrote: > This is actually a nice idea, because it's even a more nonintuitive > answer for Python newbies posting to c.l.py asking how to reverse > a string Even better: "123"*-1 We'd get to explain: - what the "*-" operator is all about, and -

Re: [Python-Dev] A Horrible Inconsistency

2006-05-26 Thread Fredrik Lundh
Sean Reifschneider wrote: >> - Treat the negative as a reverser, so we get back (3, 2, 1). > > Then we could get: > >>>> print -123 >321 > > Yay! and while we're at it, let's fix this: >>> 0.66 * (1, 2, 3) (1, 2) and maybe even this >>> 0.5 * (1, 2, 3) (1, 1) bu

Re: [Python-Dev] A Horrible Inconsistency

2006-05-26 Thread Georg Brandl
Facundo Batista wrote: > 2006/5/26, Sean Reifschneider <[EMAIL PROTECTED]>: > >> On Fri, May 26, 2006 at 12:37:02PM -0300, Facundo Batista wrote: >> >- Treat the negative as a reverser, so we get back (3, 2, 1). >> >> Then we could get: >> >>>>> print -123 >>321 > > An integer is NOT a se

Re: [Python-Dev] A Horrible Inconsistency

2006-05-26 Thread Facundo Batista
2006/5/26, Sean Reifschneider <[EMAIL PROTECTED]>: > On Fri, May 26, 2006 at 12:37:02PM -0300, Facundo Batista wrote: > >- Treat the negative as a reverser, so we get back (3, 2, 1). > > Then we could get: > >>>> print -123 >321 An integer is NOT a sequence. OTOH, that should be consiste

Re: [Python-Dev] A Horrible Inconsistency

2006-05-26 Thread Sean Reifschneider
On Fri, May 26, 2006 at 12:37:02PM -0300, Facundo Batista wrote: >- Treat the negative as a reverser, so we get back (3, 2, 1). Then we could get: >>> print -123 321 Yay! Thanks, Sean -- Sometimes it pays to stay in bed on Monday, rather than spending the rest of the week debugging Mon

Re: [Python-Dev] A Horrible Inconsistency

2006-05-26 Thread Facundo Batista
2006/5/25, Fredrik Lundh <[EMAIL PROTECTED]>: > >>> -1 * (1, 2, 3) > () > >>> -(1, 2, 3) > Traceback (most recent call last): >File "", line 1, in > TypeError: bad operand type for unary - > > We Really Need To Fix This! I don't see here an inconsistency. The operator "*" is not a multipli

Re: [Python-Dev] A Horrible Inconsistency

2006-05-26 Thread Steve Holden
Greg Ewing wrote: > Steve Holden wrote: > > >>In actual fact the effbot has lately found itself so permeated with >>Windows that it has become constituionally incapable of using a forward >>slash. Don't know what's with the square brackets though ... > > > I was thinking maybe that message ha

Re: [Python-Dev] A Horrible Inconsistency

2006-05-25 Thread Greg Ewing
Steve Holden wrote: > In actual fact the effbot has lately found itself so permeated with > Windows that it has become constituionally incapable of using a forward > slash. Don't know what's with the square brackets though ... I was thinking maybe that message had resulted from a Windows and a

Re: [Python-Dev] A Horrible Inconsistency

2006-05-25 Thread Georg Brandl
Georg Brandl wrote: > Martin v. Löwis wrote: >> Fredrik Lundh wrote: >>> >>> -1 * (1, 2, 3) >>> () >>> >>> -(1, 2, 3) >>> Traceback (most recent call last): >>>File "", line 1, in >>> TypeError: bad operand type for unary - >>> >>> We Really Need To Fix This! >> >> I can't find this incons

Re: [Python-Dev] A Horrible Inconsistency

2006-05-25 Thread Georg Brandl
Tim Peters wrote: > [Raymond Hettinger] > ... >> Also, I'm not clear on the rationale for transforming negative >> repetition counts to zero instead of raising an exception. > > There are natural use cases. Here's one: you have a string and want > to right-justify it to 80 columns with blanks if

Re: [Python-Dev] A Horrible Inconsistency

2006-05-25 Thread Steve Holden
Fredrik Lundh wrote: > Guido van Rossum wrote: > > >>>We Really Need To Fix This! >>> >>>[\F] >> >>Doesn't the real effbot have /F as sig? > > > yeah, we've had some trouble with fake bots lately. I mean, there's a > timbot posting to this thread, but I know for sure that the real Tim got >

Re: [Python-Dev] A Horrible Inconsistency

2006-05-25 Thread Fredrik Lundh
Guido van Rossum wrote: >> We Really Need To Fix This! >> >> [\F] > > Doesn't the real effbot have /F as sig? yeah, we've had some trouble with fake bots lately. I mean, there's a timbot posting to this thread, but I know for sure that the real Tim got tired of hacking on Python earlier tonig

Re: [Python-Dev] A Horrible Inconsistency

2006-05-25 Thread Tim Peters
[Raymond Hettinger] ... > Also, I'm not clear on the rationale for transforming negative > repetition counts to zero instead of raising an exception. There are natural use cases. Here's one: you have a string and want to right-justify it to 80 columns with blanks if it's shorter than 80. s

Re: [Python-Dev] A Horrible Inconsistency

2006-05-25 Thread Guido van Rossum
On 5/25/06, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > Fredrik Lundh wrote: > > > >>> -1 * (1, 2, 3) > >() > > >>> -(1, 2, 3) > >Traceback (most recent call last): > > File "", line 1, in > >TypeError: bad operand type for unary - > > > >We Really Need To Fix This! > > > > > > The second one

Re: [Python-Dev] A Horrible Inconsistency

2006-05-25 Thread Tim Peters
[Fredrik] > >>> -1 * (1, 2, 3) > () > >>> -(1, 2, 3) > Traceback (most recent call last): >File "", line 1, in > TypeError: bad operand type for unary - > > We Really Need To Fix This! What's broken? It's generally true that n*s == s*n == empty_container_of_type_type(s) whenever s is

Re: [Python-Dev] A Horrible Inconsistency

2006-05-25 Thread Raymond Hettinger
Fredrik Lundh wrote: > >>> -1 * (1, 2, 3) >() > >>> -(1, 2, 3) >Traceback (most recent call last): > File "", line 1, in >TypeError: bad operand type for unary - > >We Really Need To Fix This! > > The second one doesn't bug me. Unary minus on a sequence is meaningless. The first is a bit o

Re: [Python-Dev] A Horrible Inconsistency

2006-05-25 Thread Sean Reifschneider
On Thu, May 25, 2006 at 09:06:49PM +, Georg Brandl wrote: >Don't tell me that! I was actually working on a patch right now... While undoubtedly a performance patch, it wasn't on the list of tasks to do today. You risk Steve's wrath! Thanks, Sean -- In the end, we will remember not the word

Re: [Python-Dev] A Horrible Inconsistency

2006-05-25 Thread Martin v. Löwis
Ronald Oussoren wrote: > I don't know which one Fredrik thinks is wrong, but I think the result > of -1*(1,2,3) is very surprising. I'd expect an exception here. I agree, but this has nothing to do with whether or not the unary - is supported. Regards, Martin _

Re: [Python-Dev] A Horrible Inconsistency

2006-05-25 Thread Ronald Oussoren
On 25-mei-2006, at 23:04, Martin v. Löwis wrote: > Fredrik Lundh wrote: > -1 * (1, 2, 3) >> () > -(1, 2, 3) >> Traceback (most recent call last): >>File "", line 1, in >> TypeError: bad operand type for unary - >> >> We Really Need To Fix This! > > I can't find this inconsistency hor

Re: [Python-Dev] A Horrible Inconsistency

2006-05-25 Thread Guido van Rossum
You're joking right? On 5/25/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > >>> -1 * (1, 2, 3) > () > >>> -(1, 2, 3) > Traceback (most recent call last): >File "", line 1, in > TypeError: bad operand type for unary - > > We Really Need To Fix This! > > [\F] Doesn't the real effbot have /F

Re: [Python-Dev] A Horrible Inconsistency

2006-05-25 Thread Georg Brandl
Martin v. Löwis wrote: > Fredrik Lundh wrote: >> >>> -1 * (1, 2, 3) >> () >> >>> -(1, 2, 3) >> Traceback (most recent call last): >>File "", line 1, in >> TypeError: bad operand type for unary - >> >> We Really Need To Fix This! > > I can't find this inconsistency horrible. > > py> +"Hell

Re: [Python-Dev] A Horrible Inconsistency

2006-05-25 Thread Martin v. Löwis
Fredrik Lundh wrote: > >>> -1 * (1, 2, 3) > () > >>> -(1, 2, 3) > Traceback (most recent call last): >File "", line 1, in > TypeError: bad operand type for unary - > > We Really Need To Fix This! I can't find this inconsistency horrible. py> +"Hello" Traceback (most recent call last): F