Re: [Python-Dev] Requesting that a class be a new-style class

2005-02-19 Thread Guido van Rossum
> I didn't dig into the C but does having 'type' > as metaclass guarantee the same behavior as inheriting 'object' or does object > provide something type doesn't? *wince* No, they're equivalent. __metaclass__ = type cause the base class to be object, and a base class of object causes the metacla

[Python-Dev] UserString

2005-02-19 Thread Raymond Hettinger
I noticed that UserString objects have methods that do not accept other UserString objects as arguments: >>> from UserString import UserString >>> UserString('slartibartfast').count(UserString('a')) Traceback (most recent call last): File "", line 1, in -toplevel- UserString('slartibartfas

RE: [Python-Dev] Requesting that a class be a new-style class

2005-02-19 Thread Raymond Hettinger
> > > This is something I've typed way too many times: > > > > > > Py> class C(): > > >File "", line 1 > > > class C(): > > > ^ > > > SyntaxError: invalid syntax > > > > > > It's the asymmetry with functions that gets to me - defining a > > > function with no arguments still r

Re: [Python-Dev] Requesting that a class be a new-style class

2005-02-19 Thread Jack Diederich
On Sun, Feb 20, 2005 at 12:13:25PM +1000, Nick Coghlan wrote: > Guido van Rossum wrote: > >>>This is something I've typed way too many times: > >>> > >>>Py> class C(): > >>> File "", line 1 > >>>class C(): > >>>^ > >>>SyntaxError: invalid syntax > >>> > >>>It's the asymmetry with f

Re: [Python-Dev] Requesting that a class be a new-style class

2005-02-19 Thread Nick Coghlan
Guido van Rossum wrote: This is something I've typed way too many times: Py> class C(): File "", line 1 class C(): ^ SyntaxError: invalid syntax It's the asymmetry with functions that gets to me - defining a function with no arguments still requires parentheses in the definition s

Re: [Python-Dev] Requesting that a class be a new-style class

2005-02-19 Thread Guido van Rossum
> > This is something I've typed way too many times: > > > > Py> class C(): > >File "", line 1 > > class C(): > > ^ > > SyntaxError: invalid syntax > > > > It's the asymmetry with functions that gets to me - defining a > > function with no arguments still requires parentheses

[Python-Dev] Some old patches

2005-02-19 Thread Reinhold Birkenfeld
Hello, this time working up some of the patches with beards: - #751943 Adds the display of the line number to cgitb stack traces even when the source code is not available to cgitb. This makes sense in the case that the source is lying around somewhere else. However, the original patch g

Re: [Python-Dev] Requesting that a class be a new-style class

2005-02-19 Thread Michael Hudson
Nick Coghlan <[EMAIL PROTECTED]> writes: > This is something I've typed way too many times: > > Py> class C(): >File "", line 1 > class C(): > ^ > SyntaxError: invalid syntax > > It's the asymmetry with functions that gets to me - defining a > function with no arguments still

Re: [Python-Dev] Re: Prospective Peephole Transformation

2005-02-19 Thread Aahz
On Sat, Feb 19, 2005, "Martin v. L?wis" wrote: > Fredrik Lundh wrote: >> >>I'd say that this explains why it would still make sense to let the code >>generator change >>"x in (a, b, c)" to "x == a or x == b or x == c", as long as a, b, and c >>are all integers. > > How often does that happen in

Re: [Python-Dev] Prospective Peephole Transformation

2005-02-19 Thread M.-A. Lemburg
Raymond Hettinger wrote: Hmm, what if you'd teach tuples to do faster contains lookups for string or integer only content, e.g. by introducing sub-types for string-only and integer-only tuples ?! For a linear search, tuples are already pretty darned good and leave room for only microscopic O(n) im

Re: [Python-Dev] builtin_id() returns negative numbers

2005-02-19 Thread Martin v. Löwis
Donovan Baarda wrote: Seriously, on the Python lists there has been a discussion rejecting an md5sum implementation because the author "donated it to the public domain". Apparently lawyers have decided that you can't give code away. Intellectual charity is illegal :-) Despite the smiley: It is not

Re: [Python-Dev] Re: Prospective Peephole Transformation

2005-02-19 Thread Martin v. Löwis
Fredrik Lundh wrote: I'd say that this explains why it would still make sense to let the code generator change "x in (a, b, c)" to "x == a or x == b or x == c", as long as a, b, and c are all integers. How often does that happen in real code? Regards, Martin __

[Python-Dev] Re: builtin_id() returns negative numbers

2005-02-19 Thread Fredrik Lundh
Donovan Baarda wrote: > Apparently lawyers have decided that you can't give code away. Intellectual > charity is illegal :-) what else would a lawyer say? do you really expect lawyers to admit that there are ways to do things that don't involve lawyers?

[Python-Dev] Re: Prospective Peephole Transformation

2005-02-19 Thread Fredrik Lundh
Tim Peters wrote: > [Fredrik Lundh] >> wouldn't be the first time... > > How soon we forget . oh, that was in the dark ages of Python 1.4. I've rebooted myself many times since then... > Fredrik introduced a pile of optimizations special-casing the snot out > of small integers into ceval.c a l

Re: [Python-Dev] Requesting that a class be a new-style class

2005-02-19 Thread Michael Walter
But... only as an additional option, not as a replacement, right? Michael On Sat, 19 Feb 2005 03:01:14 -0500, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > > This is something I've typed way too many times: > > > > > > Py> class C(): > > > File "", line 1 > > > class C(): > > >

Re: [Python-Dev] Requesting that a class be a new-style class

2005-02-19 Thread Raymond Hettinger
> > This is something I've typed way too many times: > > > > Py> class C(): > > File "", line 1 > > class C(): > > ^ > > SyntaxError: invalid syntax > > > > It's the asymmetry with functions that gets to me - defining a > > function with no arguments still requires parentheses in