Re: [Python-Dev] Fwd: Re: [Python-3000] Removing functions from the operator module

2007-03-12 Thread Armin Rigo
Hi Collin,

On Mon, Mar 12, 2007 at 11:19:26AM -0500, Collin Winter wrote:
> iter() is part of every syntactic construction that takes an iterator
> argument (for, listcomps, gencomps, ...). Should it go in operator as
> well?

Historically, things that have a slot go in 'operator'.  So that would
mean that 'operator' is missing at least: getattr, setattr, delattr,
next, repr, str, len, hash, hex, oct, divmod, int, float, long,
descr_get, descr_set, descr_delete, getslice, setslice, delslice, call,
init.

Or else, things in 'operator' are the ones with a "syntactic
equivalent".  Then we should remove abs and index, and add list, tuple,
dict, buildclass, new.function, ...

Then there is stuff that doesn't fall in any category, like attrgetter, 
countOf, indexOf, ...


Not-completely-useful'y-yours,

Armin
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Fwd: Re: [Python-3000] Removing functions from the operator module

2007-03-12 Thread Guido van Rossum
Yes.

On 3/12/07, Collin Winter <[EMAIL PROTECTED]> wrote:
> On 3/11/07, Armin Rigo <[EMAIL PROTECTED]> wrote:
> > Hi Collin,
> >
> > On Wed, Mar 07, 2007 at 11:53:45PM -0600, Collin Winter wrote:
> > > bool() and abs() aren't syntax, so I would never look in operator.
> >
> > abs() is not syntax but bool() is part of every syntactic construction
> > that takes a truth value argument (if, while, and, ...)
>
> iter() is part of every syntactic construction that takes an iterator
> argument (for, listcomps, gencomps, ...). Should it go in operator as
> well?
>
> Collin Winter
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/guido%40python.org
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Fwd: Re: [Python-3000] Removing functions from the operator module

2007-03-12 Thread Collin Winter
On 3/11/07, Armin Rigo <[EMAIL PROTECTED]> wrote:
> Hi Collin,
>
> On Wed, Mar 07, 2007 at 11:53:45PM -0600, Collin Winter wrote:
> > bool() and abs() aren't syntax, so I would never look in operator.
>
> abs() is not syntax but bool() is part of every syntactic construction
> that takes a truth value argument (if, while, and, ...)

iter() is part of every syntactic construction that takes an iterator
argument (for, listcomps, gencomps, ...). Should it go in operator as
well?

Collin Winter
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Fwd: Re: [Python-3000] Removing functions from the operator module

2007-03-11 Thread Armin Rigo
Hi Collin,

On Wed, Mar 07, 2007 at 11:53:45PM -0600, Collin Winter wrote:
> bool() and abs() aren't syntax, so I would never look in operator.

abs() is not syntax but bool() is part of every syntactic construction
that takes a truth value argument (if, while, and, ...)


A bientot,

Armin
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Fwd: Re: [Python-3000] Removing functions from the operator module

2007-03-07 Thread Collin Winter
On 3/7/07, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> [Collin Winter]
> >> I don't suppose you've changed your mind about removing operator.truth
> >> and operator.abs in the seven months since this discussion?
>
> [GvR]
> >No, though I think that operator.truth should be renamed to operator.bool.
> >
> >I like the idea that for each built-in op there's a callable in operator.
>
> It makes sense to me that built-in ops like + have a corresponding operator 
> function like operator.__add__(), but I don't follow how this logic applies 
> to abs() and bool().  ISTM, operator.bool and operator.abs would not add any 
> value beyond what is already provided by __builtin__.bool and __builtin__.abs.
>

FWIW, I've always thought of the operator module as a place to look
when I need to pass some bit of syntax (eg., attribute lookup, "in",
addition) to a higher-order function. bool() and abs() aren't syntax,
so I would never look in operator.

Collin Winter
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Fwd: Re: [Python-3000] Removing functions from the operator module

2007-03-07 Thread Guido van Rossum
They do, by emphasizing the relationship with special methods.

On 3/7/07, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> [Collin Winter]
> >> I don't suppose you've changed your mind about removing operator.truth
> >> and operator.abs in the seven months since this discussion?
>
> [GvR]
> >No, though I think that operator.truth should be renamed to operator.bool.
> >
> >I like the idea that for each built-in op there's a callable in operator.
>
> It makes sense to me that built-in ops like + have a corresponding operator 
> function like operator.__add__(), but I don't follow how this logic applies 
> to abs() and bool().  ISTM, operator.bool and operator.abs would not add any 
> value beyond what is already provided by __builtin__.bool and __builtin__.abs.
>
>
> Raymond
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/guido%40python.org
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Fwd: Re: [Python-3000] Removing functions from the operator module

2007-03-07 Thread Raymond Hettinger
[Collin Winter]
>> I don't suppose you've changed your mind about removing operator.truth
>> and operator.abs in the seven months since this discussion?

[GvR]
>No, though I think that operator.truth should be renamed to operator.bool.
>
>I like the idea that for each built-in op there's a callable in operator.

It makes sense to me that built-in ops like + have a corresponding operator 
function like operator.__add__(), but I don't follow how this logic applies to 
abs() and bool().  ISTM, operator.bool and operator.abs would not add any value 
beyond what is already provided by __builtin__.bool and __builtin__.abs.


Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com