In article 4d8be3bb.4030...@v.loewis.de,
Martin v. Loewis mar...@v.loewis.de wrote:
Martin deleted the attribution for Carl Banks:
The cmp argument doesn't depend in any way on an object's __cmp__
method, so getting rid of __cmp__ wasn't any good readon to also get
rid of the cmp argument
So
On 04/09/11 01:08, Aahz wrote:
Actually, my take is that removing __cmp__ was a mistake. (I already
argued about it back in python-dev before it happened, and I see little
point rehashing it. My reason is strictly efficiency grounds: when
comparisons are expensive -- such as Decimal object
In article 4d9f32a2$1...@dnews.tpgi.com.au,
Lie Ryan lie.1...@gmail.com wrote:
On 04/09/11 01:08, Aahz wrote:
Actually, my take is that removing __cmp__ was a mistake. (I already
argued about it back in python-dev before it happened, and I see little
point rehashing it. My reason is
On Fri, Apr 01, 2011 at 10:21:33PM -0400, Terry Reedy wrote:
rewriting cmp_to_key in C is underway
http://bugs.python.org/issue11707
Nice to know! Any chance this wil get into 2.7.x?
--
Antoon Pardon
--
http://mail.python.org/mailman/listinfo/python-list
On 04/04/11 19:34, Antoon Pardon wrote:
On Fri, Apr 01, 2011 at 10:21:33PM -0400, Terry Reedy wrote:
rewriting cmp_to_key in C is underway
http://bugs.python.org/issue11707
Nice to know! Any chance this wil get into 2.7.x?
Python 2.7 still have list.sort(cmp=...)/sorted(cmp=...), so
On 4/4/2011 5:34 AM, Antoon Pardon wrote:
On Fri, Apr 01, 2011 at 10:21:33PM -0400, Terry Reedy wrote:
rewriting cmp_to_key in C is underway
http://bugs.python.org/issue11707
Nice to know! Any chance this wil get into 2.7.x?
I posted the question to the issue.
--
Terry Jan Reedy
--
On 4/4/2011 9:35 AM, Lie Ryan wrote:
On 04/04/11 19:34, Antoon Pardon wrote:
On Fri, Apr 01, 2011 at 10:21:33PM -0400, Terry Reedy wrote:
rewriting cmp_to_key in C is underway
http://bugs.python.org/issue11707
Nice to know! Any chance this wil get into 2.7.x?
Python 2.7 still have
O
fix exactly, and there is always worry that permanance enhancements may
have unforseen side effects. I will let Raymond make the call on this.
/permanance/performance/, /unforseen/unforeseen/
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 2, 5:13 am, Steven D'Aprano steve
+comp.lang.pyt...@pearwood.info wrote:
Should I use the list, list2, sortable_list, sortable_list2,
sortable_lost3, [note spelling, which we're stuck with forever],
heterogeneous_list, heterogeneous_list_without_stooge_sort, new_list,
fancy_list,
On Tue, Apr 5, 2011 at 7:10 AM, rantingrick rantingr...@gmail.com wrote:
olks who have vast libraries of Python
code that have been rendered useless because a few elites have spent
too much time lamenting minutia.
How is the code rendered useless when (a) Python 2.7 is still the
default Python
rantingrick wrote:
Yes and whilst that was a brilliant display of bombastic arrogance
your statements miss the point completely.
And what about the large steaming pile of elephant dung in
the room your nose seems to be unable to smell?
As we all know Python has experienced an explosion of
On Apr 4, 4:41 pm, Chris Angelico ros...@gmail.com wrote:
How is the code rendered useless when (a) Python 2.7 is still the
default Python in many places,
That's the point. We are going to see Python2.x around for a very long
time. A *very* long time Chris. Sadly if this conversion was planned
On Tue, Apr 5, 2011 at 8:16 AM, rantingrick rantingr...@gmail.com wrote:
and (b) in any place where it's not,
it's going to be about one command to install a python2?
Oh thanks Chris for revealing the simplicity of 2 to 3 code porting.
And might ask where you will begin to volunteer your
On Mon, 04 Apr 2011 17:09:07 -0500, harrismh777 wrote:
Python(3) is a new language. It has many of the same characteristics
of Python2, but will be more consistent, cleaner, leaner, more robust...
and certainly loved more universally by more people the world over for
centuries to come
On Tue, 05 Apr 2011 07:41:37 +1000, Chris Angelico wrote:
On Tue, Apr 5, 2011 at 7:10 AM, rantingrick rantingr...@gmail.com
wrote:
olks who have vast libraries of Python code that have been rendered
useless because a few elites have spent too much time lamenting
minutia.
How is the code
Steven D'Aprano wrote:
I prefer to consider Python 2.7 and Python 3.x as different dialects of
the same language. There are a very few handful of incompatibilities,
most of which can be automatically resolved by the 2to3 fixers.
Yes, I am actually finding this to be consistent with my
On Tuesday, April 5, 2011 2:16:07 AM UTC+1, harrismh777 wrote:
Steven D'Aprano wrote:
I prefer to consider Python 2.7 and Python 3.x as different dialects of
the same language. There are a very few handful of incompatibilities,
most of which can be automatically resolved by the 2to3 fixers.
On 4/4/2011 9:16 PM, harrismh777 wrote:
Another item that would be nice as an IDLE enhancement would be a menu
option that applies the fixers (either direction depending on version
2.7 -- 3.2) right in the IDE. Entries that could not be fixed could be
flagged for manual update.
I have had the
On Sat, Apr 2, 2011 at 4:01 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
On Fri, 01 Apr 2011 18:22:01 -0700, geremy condra wrote:
[...]
I don't have a horse in this race, but I do wonder how much of Python
could actually survive this test. My first (uneducated) guess is not
On 3 Apr 2011, at 16:22, geremy condra wrote:
I think we're talking at cross purposes. The point I'm making is that
there are lots of issues where popularity as a third party module
isn't really a viable test for whether a feature is sufficiently
awesome to be in core python. As part of
On 3 Apr 2011, at 15:30, harrismh777 wrote:
Brian Quinlan wrote:
I suspect that this debate is a sink hole that I won't be able to
escape
from alive but...
... live long and prosper my friend.
Something to consider is that OOP philosophy is technically one of
the most aesthetic
geremy condra wrote:
Something to consider is that OOP philosophy is technically one of the most
aesthetic concepts in all of computer science--- with pure functional
programming (haskel, erlang) as a close second...
I like how you inserted the word 'technically' in there to give this
On Sun, 03 Apr 2011 16:34:34 +1000, Brian Quinlan wrote:
On 3 Apr 2011, at 16:22, geremy condra wrote:
I think we're talking at cross purposes. The point I'm making is that
there are lots of issues where popularity as a third party module isn't
really a viable test for whether a feature is
On Sun, Apr 3, 2011 at 3:21 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
On Sun, 03 Apr 2011 16:34:34 +1000, Brian Quinlan wrote:
On 3 Apr 2011, at 16:22, geremy condra wrote:
I think we're talking at cross purposes. The point I'm making is that
there are lots of issues
On 4/3/2011 1:26 AM, harrismh777 wrote:
Very interesting. Your explanations (and other excellent contributions
here) have shown an intense variation of diversity of viewpoint within
at least the comp.lang. community with regard to the Python language.
If you really want to see variation of
On Sat, Apr 2, 2011 at 4:17 PM, harrismh777 harrismh...@charter.net wrote:
Chris Angelico wrote:
Why this lengthy discussion on whether Python is object-oriented or
not? What difference does it make?
Great question... glad you asked...!
But bad things sometimes have to happen. And
Chris Angelico wrote:
I've been a C++ programmer for nearly twenty years. I think I know a
few things about OOP. Actually, I've done OOP in non-OO languages;
most notably, plain old C. The OS/2 Presentation Manager class
hierarchy (SOM) is primarily implemented in C, for instance. My point
is
On Fri, 01 Apr 2011 23:54:53 -0500, harrismh777 wrote:
It cannot be denied that we are talking exclusively about OOP. End of
story.
Yes it can be denied. You are categorically *wrong*. Python is a multi-
paradigm language that happens to use objects exclusively as its
fundamental data type,
On Fri, 01 Apr 2011 15:37:34 -0400, Terry Reedy wrote:
On 4/1/2011 3:45 AM, Paul Rubin wrote:
What happens then is you define a new interface. In Microsoft-speak if
the IWhatever interface needs an incompatible extension like new
parameters, they introduce IWhatever2 which supports the new
On Fri, 01 Apr 2011 18:22:01 -0700, geremy condra wrote:
[...]
I don't have a horse in this race, but I do wonder how much of Python
could actually survive this test. My first (uneducated) guess is not
very much- we would almost certainly lose large pieces of the string
API and other builtins,
I suspect that this debate is a sink hole that I won't be able to
escape from alive but...
On 2 Apr 2011, at 19:29, harrismh777 wrote:
In other words, does the PSF have a responsibility to maintain the
L.sort(cmp= key= reverse=) interface for strictly *philosophical*
principle based on
, sort still takes a cmp argument, so what's the
problem?
Until that happens, for Python 2
users, Python 3 is just a fork of Python with some stuff added and some
stuff broken, that might get its act together someday. I see in the
subject of this thread, Guido rethinking removal of cmp from
On 4/2/2011 4:29 AM, harrismh777 wrote:
I am responding to both this and a previous post of yours.
Python is not a thing, but an abstraction of multiple parts. It is a
name, a trademark of the Python Software Foundation. It is a Platonic
ideal in the mind of Guido and others. It is a series*
Steven D'Aprano wrote:
It cannot be denied that we are talking exclusively about OOP. End of
story.
Yes it can be denied.
All data structures and primitives in Python are objects, but the
language is not exclusively object-oriented.
Yeah, I know, Steven. The discussion, from which my
Terry Reedy wrote:
In other words, does the PSF have a responsibility to maintain the
L.sort(cmp= key= reverse=) interface for strictly *philosophical*
principle based on established norms for *any* OOP language?
No.
I say this based on the philosophical principle that obligations are
Brian Quinlan wrote:
I suspect that this debate is a sink hole that I won't be able to escape
from alive but...
... live long and prosper my friend.
Something to consider is that OOP philosophy is technically one of the
most aesthetic concepts in all of computer science--- with pure
On Sat, Apr 2, 2011 at 10:30 PM, harrismh777 harrismh...@charter.net wrote:
Brian Quinlan wrote:
I suspect that this debate is a sink hole that I won't be able to escape
from alive but...
... live long and prosper my friend.
Something to consider is that OOP philosophy is technically one
Steven D'Aprano wrote:
The difference between implementation and interface is
not specific to object-oriented code --
When I speak of implementation vs interface I am speaking from a
strictly object oriented philosophy, as pedigree, from Grady Booch, whom
I consider to be the father of
On Fri, Apr 1, 2011 at 5:13 PM, harrismh777 harrismh...@charter.net wrote:
Corollary 1)a The Class interface never encapsulates cruft.
Provably false. Even a well-designed interface, if it is asked to deal
with a changing implementation and changing requirements, will
eventually either
Terry Reedy wrote:
Python 3 was announced and as a mildly code breaking version at least 5
years before it came out.
I appreciate the spirit of your arguments overall, and I do not
necessarily disagree with much of what you are saying. I would like to
challenge you to see this from a
Chris Angelico ros...@gmail.com writes:
Provably false. Even a well-designed interface, if it is asked to deal
with a changing implementation and changing requirements, will
eventually either acquire cruft, or be found too rigid to be of use.
What happens then is you define a new interface.
On 4/1/2011 3:45 AM, Paul Rubin wrote:
Removing cmp certainly isn't the most disruptive change of Python 3,
That was almost certainly the ascii to unicode switch for strings. It is
still not quite complete in 3.2 but should be pretty well ironed out in 3.3.
but it seems like the one with
On 4/1/2011 2:13 AM, harrismh777 wrote:
When I speak of implementation vs interface I am speaking from a
strictly object oriented philosophy, as pedigree, from Grady Booch, whom
I consider to be the father of Object Oriented Analysis and Design
(Booch, OO AD with apps, 1994).
Python is object
On 4/1/2011 3:45 AM, Paul Rubin wrote:
What happens then is you define a new interface.
Like key= versus cmp=
In Microsoft-speak if
the IWhatever interface needs an incompatible extension like new
parameters, they introduce IWhatever2 which supports the new parameters.
They change the
On 4/1/2011 2:44 AM, harrismh777 wrote:
Terry Reedy wrote:
Python 3 was announced and as a mildly code breaking version at least 5
years before it came out.
I appreciate the spirit of your arguments overall, and I do not
necessarily disagree with much of what you are saying. I would like to
On Fri, Apr 1, 2011 at 10:06 AM, Terry Reedy tjre...@udel.edu wrote:
On 4/1/2011 2:13 AM, harrismh777 wrote:
When I speak of implementation vs interface I am speaking from a
strictly object oriented philosophy, as pedigree, from Grady Booch, whom
I consider to be the father of Object
Terry Reedy tjre...@udel.edu writes:
What happens then is you define a new interface.
Like key= versus cmp=
Well, in an untyped language like Python, adding a feature to an
interface doesn't require defining a new interface unless you change
something incompatibly. key= is very useful but it
Terry Reedy tjre...@udel.edu writes:
Never change an advertised Class interface.
In Python, class interfaces are no more sacred than module or function
interfaces. If one takes 'no interface change' literally, then Python
would have to be frozen. Even bug fixes change a defacto interface.
Oh
On 4/1/2011 3:45 AM, Paul Rubin wrote:
What happens then is you define a new interface. In Microsoft-speak if
the IWhatever interface needs an incompatible extension like new
parameters, they introduce IWhatever2 which supports the new parameters.
They change the implementation of IWhatever so
Terry Reedy tjre...@udel.edu writes:
But the Perl 6 fiasco
Perl 6 a complete failure? Wow, must be coming from a clueless Python
zealot. If Perl 6 is a fiasco, so is Python 3. Both are not considered
production ready, and both can be downloaded and used today:
http://rakudo.org/
Next release
On Mon, Mar 28, 2011 at 10:11 PM, Dan Stromberg drsali...@gmail.com wrote:
On Mon, Mar 28, 2011 at 6:58 PM, Paul Rubin no.email@nospam.invalidwrote:
DSU is a clever and useful design pattern, but comparison
sorting is what all the sorting textbooks are written about.
Actually, even though
On Wed, Mar 30, 2011 at 7:13 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
snip
Or, an alternative approach would be for one of the cmp-supporters to
take the code for Python's sort routine, and implement your own sort-with-
cmp (in C, of course, a pure Python solution will
Terry Reedy tjre...@udel.edu writes:
IWhatever2 setting the new parameters to default values
Now you have two versions, and eventually many more, to maintain and
document.
In the case of cmp= there's not two interfaces needed. Python2 does a
perfectly good job supporting cmp and key with one
On Fri, 01 Apr 2011 14:31:09 -0700, geremy condra wrote:
On Wed, Mar 30, 2011 at 7:13 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
snip
Or, an alternative approach would be for one of the cmp-supporters to
take the code for Python's sort routine, and implement your own
On Fri, 01 Apr 2011 14:37:20 -0700, Paul Rubin wrote:
I actually think Python3 actually didn't go far enough in fixing
Python2. I'd have frankly preferred delaying it by a few years, to
allow PyPy to come to maturity and serve as the new main Python
implementation, and have that drive the
On Fri, 01 Apr 2011 13:42:11 -0600, John Bokma wrote:
Terry Reedy tjre...@udel.edu writes:
But the Perl 6 fiasco
Perl 6 a complete failure?
Fiasco does not mean complete failure. It is a debacle, an
embarrassing, serious failure, (and also an Italian wine bottle with a
rounded bottom),
On Fri, Apr 1, 2011 at 5:41 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
On Fri, 01 Apr 2011 14:31:09 -0700, geremy condra wrote:
On Wed, Mar 30, 2011 at 7:13 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
snip
Or, an alternative approach would be for
On 4/1/2011 3:22 PM, Paul Rubin wrote:
2to3 could probably gain a fixer to change
.sort(cmp=f) # to
import functools import cmp_to_key
.sort(key=functools.cmp_to_key(f))
I know some would not like this because interface change is not their
real concern.
Looks like a good idea. There is an
someday. I see in the
subject of this thread, Guido rethinking removal of cmp from sort
method which gives hope that one particular bit of breakage might get
fixed.
the fact is that it is gone, and therefore re-adding it is a new feature
request. Those who want cmp functionality in Python 3
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes:
There's always Python 4000 :)
Is that on the boards yet?
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, Apr 2, 2011 at 1:29 PM, Paul Rubin no.email@nospam.invalid wrote:
If sorting is in the stdlib like functools is, then the similarity
makes sense and the suggestion isn't so bad. But you're proposing a 3rd
party module, which is not the same thing at all. Batteries included
actually
Paul Rubin no.email at nospam.invalid writes:
I actually think Python3 actually didn't go far enough in fixing
Python2. I'd have frankly preferred delaying it by a few years, to
allow PyPy to come to maturity and serve as the new main Python
implementation, and have that drive the language
Benjamin Peterson benja...@python.org writes:
Why would having PyPy as the reference implementation have made this design
decisions turn out better?
A fair amount of Python 2's design was influenced by what was convenient
or efficient to implement in CPython. There's nothing wrong with that
On Fri, Apr 1, 2011 at 8:43 PM, Paul Rubin no.email@nospam.invalid wrote:
Benjamin Peterson benja...@python.org writes:
Why would having PyPy as the reference implementation have made this
design
decisions turn out better?
A fair amount of Python 2's design was influenced by what was
Terry Reedy wrote:
When I speak of implementation vs interface I am speaking from a
strictly object oriented philosophy, as pedigree, from Grady Booch, whom
I consider to be the father of Object Oriented Analysis and Design
(Booch, OO AD with apps, 1994).
Python is object based but not
On Sat, Apr 2, 2011 at 3:54 PM, harrismh777 harrismh...@charter.net wrote:
Terry Reedy wrote:
When I speak of implementation vs interface I am speaking from a
strictly object oriented philosophy, as pedigree, from Grady Booch, whom
I consider to be the father of Object Oriented Analysis and
Terry Reedy wrote:
So why is there a problem with cmp? Because there are people who want
most of the changes that break your rules, but not this particular one.
Sadly, Terry, there may be some truth in there.
Often folks whine about this or that, and they have absolutely no reason
(or
Chris Angelico wrote:
Why this lengthy discussion on whether Python is object-oriented or
not? What difference does it make?
Great question... glad you asked...!
But bad things sometimes have to happen. And that's why things are
versioned.
You didn't read the post... cmp removal
Antoon Pardon wrote:
On Sun, Mar 13, 2011 at 12:59:55PM +, Steven D'Aprano wrote:
The removal of cmp from the sort method of lists is probably the most
disliked change in Python 3. On the python-dev mailing list at the
moment, Guido is considering whether or not it was a mistake.
If anyone
On Thu, 31 Mar 2011 01:34:17 -0500, harrismh777 wrote:
Many of you (Guido included) have lost significant sight of a
critical object oriented philosophical pillar (but not all of you, thank
goodness). To cut right to the heart of it--- NEVER change an advertised
interface.
Thanks for
On Thu, Mar 31, 2011 at 02:13:53AM +, Steven D'Aprano wrote:
On Wed, 30 Mar 2011 11:06:20 +0200, Antoon Pardon wrote:
As far as I can see, key will only produce significant speedups, if
comparing items can then be completly done internally in the python
engine without referencing user
Antoon Pardon antoon.par...@rece.vub.ac.be writes:
Something else the dev team can consider, is a Negation class
This would have to be done by the dev team since I
guess that writing such a thing in Python would loose all the speed
of using a key-function.
That is a good idea. SQL has
On 3/31/2011 2:34 AM, harrismh777 wrote:
breaking a fundamental law of object oriented programming... don't break
and advertised interface (particularly if it is useful and people are
actually making use of it!).
This is insane folks.
Each x.y version (starting with 2.3) is feature stable:
On Tue, Mar 29, 2011 at 03:35:40PM -0400, Terry Reedy wrote:
For anyone interested, the tracker discussion on removing cmp is at
http://bugs.python.org/issue1771
There may have been more on the old py3k list and pydev list.
One point made there is that removing cmp= made list.sort consistent
On Wed, 30 Mar 2011 11:06:20 +0200, Antoon Pardon wrote:
As far as I can see, key will only produce significant speedups, if
comparing items can then be completly done internally in the python
engine without referencing user python code.
Incorrect. You don't even need megabytes of data to see
On Mon, Mar 28, 2011 at 11:35:09AM +, Steven D'Aprano wrote:
[...]
Forcing people to use a key-function, will produce cases where python
will ask for more memory and take longer to sort, than allowing to
provide a cmp function.
More memory yes; take longer to sort, almost certainly
On Mon, Mar 28, 2011 at 03:43:03PM +, Steven D'Aprano wrote:
On Mon, 28 Mar 2011 14:39:04 +0200, Antoon Pardon wrote:
I tried to sort lists of 1 elemens. Each element a tuple two items
that was to be sorted first according to the first item in ascending
order, then according to
Steven D'Aprano wrote:
On Fri, 25 Mar 2011 10:21:35 +0100, Antoon Pardon wrote:
On Thu, Mar 24, 2011 at 11:49:53PM +, Steven D'Aprano wrote:
On Thu, 24 Mar 2011 17:47:05 +0100, Antoon Pardon wrote:
However since that seems to be a problem for you I will be more
detailed.
On Tue, Mar 29, 2011 at 1:46 AM, Antoon Pardon antoon.par...@rece.vub.ac.be
wrote:
The double sort is useless if the actual sorting is done in a different
module/function/method than the module/function/method where the order
is implemented. It is even possible you didn't write the module
On 29/03/2011 18:01, Dan Stromberg wrote:
On Tue, Mar 29, 2011 at 1:46 AM, Antoon Pardon
antoon.par...@rece.vub.ac.be mailto:antoon.par...@rece.vub.ac.be wrote:
The double sort is useless if the actual sorting is done in a different
module/function/method than the
On Wed, Mar 30, 2011 at 5:57 AM, MRAB pyt...@mrabarnett.plus.com wrote:
You would have to do more than that.
For example, A, but if you negate both strings you get
\xBE, not \xBE.
Strings effectively have an implicit character at the end that's less
than any other character. Easy fix:
For anyone interested, the tracker discussion on removing cmp is at
http://bugs.python.org/issue1771
There may have been more on the old py3k list and pydev list.
One point made there is that removing cmp= made list.sort consistent
with all the other comparision functions,
On Tue, Mar 29, 2011 at 1:08 PM, Chris Angelico ros...@gmail.com wrote:
On Wed, Mar 30, 2011 at 5:57 AM, MRAB pyt...@mrabarnett.plus.com wrote:
You would have to do more than that.
For example, A, but if you negate both strings you get
\xBE, not \xBE.
Strings effectively have an
On Wed, Mar 30, 2011 at 6:48 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
Not to mention that it still has bugs:
\0
\xff \xff\xff
That's because \0 isn't less than any character, nor is \xff greater
than any. However, the latter is true if (for instance) your string is
in UTF-8; it may be
On Tue, Mar 29, 2011 at 12:48 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Tue, Mar 29, 2011 at 1:08 PM, Chris Angelico ros...@gmail.com wrote:
On Wed, Mar 30, 2011 at 5:57 AM, MRAB pyt...@mrabarnett.plus.com
wrote:
You would have to do more than that.
For example, A, but if you
On 29/03/2011 21:32, Dan Stromberg wrote:
On Tue, Mar 29, 2011 at 12:48 PM, Ian Kelly ian.g.ke...@gmail.com
mailto:ian.g.ke...@gmail.com wrote:
On Tue, Mar 29, 2011 at 1:08 PM, Chris Angelico ros...@gmail.com
mailto:ros...@gmail.com wrote:
On Wed, Mar 30, 2011 at 5:57 AM, MRAB
On Tue, Mar 29, 2011 at 5:06 PM, MRAB pyt...@mrabarnett.plus.com wrote:
I think I've found a solution:
class NegStr:
def __init__(self, value):
self._value = value
def __lt__(self, other):
return self._value other._value
IOW:
cmp_to_key(lambda x, y:
Ian Kelly ian.g.ke...@gmail.com writes:
cmp_to_key(lambda x, y: -cmp(x, y))
cmp_to_key(lambda x, y: cmp(y, x))
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Mar 25, 2011 at 10:40:03PM +, Steven D'Aprano wrote:
On Fri, 25 Mar 2011 13:56:23 +0100, Antoon Pardon wrote:
Look we are provided with the cmp_to_key function. If something doesn't
work with that function or performs realy bad with that function, it
means either the function
On Mon, 28 Mar 2011 11:06:20 +0200, Antoon Pardon wrote:
On Fri, Mar 25, 2011 at 10:40:03PM +, Steven D'Aprano wrote:
On Fri, 25 Mar 2011 13:56:23 +0100, Antoon Pardon wrote:
Look we are provided with the cmp_to_key function. If something
doesn't work with that function or performs
On Fri, Mar 25, 2011 at 10:06:59PM +, Steven D'Aprano wrote:
On Fri, 25 Mar 2011 10:21:35 +0100, Antoon Pardon wrote:
On Thu, Mar 24, 2011 at 11:49:53PM +, Steven D'Aprano wrote:
On Thu, 24 Mar 2011 17:47:05 +0100, Antoon Pardon wrote:
However since that seems to be a problem
Antoon Pardon antoon.par...@rece.vub.ac.be wrote:
I tried to sort lists of 1 elemens. Each element a tuple two items
that was to be sorted first according to the first item in ascending
order, then according to the second item in descending order. This was
done on python 2.6 so I had to
On Mon, 28 Mar 2011 14:39:04 +0200, Antoon Pardon wrote:
I tried to sort lists of 1 elemens. Each element a tuple two items
that was to be sorted first according to the first item in ascending
order, then according to the second item in descending order. This was
done on python 2.6 so I
On Mon, Mar 28, 2011 at 11:06:20AM +0200, Antoon Pardon wrote:
Asking for *real-world* uses is just how the python community smothers
requests.
It's quite a common strategy, I've seen it used in many
contexts. Which doesn't make it any more acceptable of
course.
Should someone come with a
On Mar 28, 8:43 am, Steven D'Aprano steve
+comp.lang.pyt...@pearwood.info wrote:
Thank you for spending the time to get some hard data, but I can't
replicate your results since you haven't shown your code. Rather than
attempt to guess what you did and duplicate it, I instead came up with my
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes:
There are lots of problems that Python is not well-suited for.
It is not well-suited for writing the driver to a graphics card.
It is not well-suited to calculating pi to a trillion decimal places.
...
But sorting moderate amounts of
On Mon, Mar 28, 2011 at 6:58 PM, Paul Rubin no.email@nospam.invalid wrote:
DSU is a clever and useful design pattern, but comparison
sorting is what all the sorting textbooks are written about.
Actually, even though I wrote one program that could almost benefit from cmp
sorting that might
Steven D'Aprano wrote:
On Fri, 25 Mar 2011 10:21:35 +0100, Antoon Pardon wrote:
The reason Guido is considering re-introducing cmp is that somebody
at Google approached him with a use-case where a key-based sort did
not work. The use-case was that the user had masses of data, too
much data
On Fri, 25 Mar 2011 16:04:02 -0700, Carl Banks wrote:
On Mar 25, 3:06 pm, Steven D'Aprano steve
+comp.lang.pyt...@pearwood.info wrote:
The reason Guido is considering re-introducing cmp is that somebody at
Google approached him with a use-case where a key-based sort did not
work. The
On Mar 25, 2:00 pm, Stefan Behnel stefan...@behnel.de wrote:
Westley Martínez, 25.03.2011 14:39:
On Fri, 2011-03-25 at 07:11 +0100, Stefan Behnel wrote:
Steven D'Aprano, 25.03.2011 06:46:
On Thu, 24 Mar 2011 18:32:11 -0700, Carl Banks wrote:
It's probably the least justified builtin
1 - 100 of 152 matches
Mail list logo