On 2008-01-09, Christian Heimes wrote:
> Guido van Rossum wrote:
> > That's a different issue altogether (and your wish is not likely going
> > to be granted unless you write a PEP).
>
> You could write and implement a PEP about exposing the tp_richcompare
> slot to Python code.
>
> import sys
>
>
Dnia 09-01-2008, Śr o godzinie 01:49 +0100, Christian Heimes pisze:
> You could write and implement a PEP about exposing the tp_richcompare
> slot to Python code.
How is it better than separate __eq__, __lt__ etc.? In most cases the
rich comparison starts with dispatching on the operation and tre
On Jan 9, 2008 12:04 AM, Mark Summerfield <[EMAIL PROTECTED]> wrote:
> I'm using this as a class decorator that fills in "missing" comparisons:
>
> def complete_comparisons(cls):
> class CompleteComparisonsError(Exception): pass
>
> if hasattr(cls.__lt__, "__objclass__"): # i.e. < inherited
Steve Bethard writes:
> On Jan 8, 2008 3:55 PM, Brett Cannon <[EMAIL PROTECTED]> wrote:
> > On Jan 8, 2008 2:41 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> > > list.sort() and built-in sorted() are the least of our problems: even
> > > though the API uses cmp, the implementation actually only
On Wed, Jan 09, 2008 at 11:26:52AM -0800, Bill Janssen wrote:
> I'm a bit baffled here; I find cmp() fairly handy in writing sort
> routines:
>
>newlist = oldlist.sort(lambda v1, v2: cmp(v1.attr_x, v2.attr_x))
>
> Is there a better / newer / official way of doing this?
newlist = oldlist.s
On Jan 9, 2008 11:34 AM, Oleg Broytmann <[EMAIL PROTECTED]> wrote:
> On Wed, Jan 09, 2008 at 11:26:52AM -0800, Bill Janssen wrote:
> > I'm a bit baffled here; I find cmp() fairly handy in writing sort
> > routines:
> >
> >newlist = oldlist.sort(lambda v1, v2: cmp(v1.attr_x, v2.attr_x))
> >
> >
On Wed, Jan 09, 2008 at 11:34:59AM -0800, Brett Cannon wrote:
> On Jan 9, 2008 11:34 AM, Oleg Broytmann <[EMAIL PROTECTED]> wrote:
> >newlist = oldlist.sort(key=lambda v: v.attr_x)
>
> And don't forget about operator.attrgetter().
I don't like it for the task. To use I need to import opera
On 9-Jan-08, at 11:41 AM, Oleg Broytmann wrote:
> On Wed, Jan 09, 2008 at 11:34:59AM -0800, Brett Cannon wrote:
>> On Jan 9, 2008 11:34 AM, Oleg Broytmann <[EMAIL PROTECTED]> wrote:
>>>newlist = oldlist.sort(key=lambda v: v.attr_x)
>>
>> And don't forget about operator.attrgetter().
>
>I d
>From PEP 3116: "BufferedRandom implementation is for all random-access
objects, whether they are read-only, write-only, or *read-write*."
(emphasis mine) However, from the pseudo-code for open(),
"if reading + writing + appending > 1:
raise ValueError("can't have read/write/append mode at once
hashcollision wrote:
>>From PEP 3116: "BufferedRandom implementation is for all random-access
> objects, whether they are read-only, write-only, or *read-write*."
> (emphasis mine) However, from the pseudo-code for open(),
> "if reading + writing + appending > 1:
> raise ValueError("can't have
10 matches
Mail list logo