On 10/8/14 5:49 PM, Ethan Furman wrote:
[redirecting back to the list]
On 10/08/2014 02:23 PM, random...@fastmail.us wrote:
On Wed, Oct 8, 2014, at 15:53, Ethan Furman wrote:
On 10/08/2014 12:49 PM, random...@fastmail.us wrote:
On Wed, Oct 8, 2014, at 15:38, Ethan Furman wrote:
LOL, no kidd
On 10/08/2014 03:46 PM, Terry Reedy wrote:
On 10/8/2014 5:49 PM, Ethan Furman wrote:
[redirecting back to the list]
I'm not sure what situation you would have to type them (as opposed to
simply a + b) that the operator module would help with.
unittest springs to mind:
self.assertRaises
On 10/8/2014 5:49 PM, Ethan Furman wrote:
[redirecting back to the list]
I'm not sure what situation you would have to type them (as opposed to
simply a + b) that the operator module would help with.
unittest springs to mind:
self.assertRaises(TypeError, op.add, obj1, obj2)
Er, my poi
On Wed, Oct 8, 2014 at 3:30 PM, Chris Angelico wrote:
> >
> >
> > That doesn't always seem to have been the case, however.
> > In Python 2.7 and 3.3, I get
> >
> operator.add is operator.__add__
> > False
>
> Huh. So it is.
>
> rosuav@sikorsky:~$ python3
> Python 3.5.0a0 (default:301b9a58021
On Thu, Oct 9, 2014 at 8:37 AM, Gregory Ewing
wrote:
> Chris Angelico wrote:
>
> operator.add is operator.__add__
>>
>> True
>
>
> That doesn't always seem to have been the case, however.
> In Python 2.7 and 3.3, I get
>
operator.add is operator.__add__
> False
Huh. So it is.
rosuav@sik
random...@fastmail.us writes:
> On Wed, Oct 8, 2014, at 15:38, Ethan Furman wrote:
> > The main reason I bother using the operator module is for the
> > readability of not seeing the dunders, and the writability of not
> > having to type them.
>
> I'm not sure what situation you would have to type
On Wed, Oct 8, 2014 at 2:05 PM, Gelonida N wrote:
> On 10/8/2014 9:09 PM, Terry Reedy wrote:
>
>> On 10/8/2014 6:57 AM, Steven D'Aprano wrote:
>>
>> According to the documentation, operator.__add__ is the "official"
>>> function,
>>> and operator.add is just there for convenience.
>>>
>>
>> You
[redirecting back to the list]
On 10/08/2014 02:23 PM, random...@fastmail.us wrote:
On Wed, Oct 8, 2014, at 15:53, Ethan Furman wrote:
On 10/08/2014 12:49 PM, random...@fastmail.us wrote:
On Wed, Oct 8, 2014, at 15:38, Ethan Furman wrote:
LOL, no kidding! The main reason I bother using the
Chris Angelico wrote:
operator.add is operator.__add__
True
That doesn't always seem to have been the case, however.
In Python 2.7 and 3.3, I get
>>> operator.add is operator.__add__
False
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, Oct 8, 2014 at 3:05 PM, Gelonida N wrote:
> On 10/8/2014 9:09 PM, Terry Reedy wrote:
>>
>> On 10/8/2014 6:57 AM, Steven D'Aprano wrote:
>>
>>> According to the documentation, operator.__add__ is the "official"
>>> function,
>>> and operator.add is just there for convenience.
>>
>>
>> You a
On 10/8/2014 9:09 PM, Terry Reedy wrote:
On 10/8/2014 6:57 AM, Steven D'Aprano wrote:
According to the documentation, operator.__add__ is the "official"
function,
and operator.add is just there for convenience.
You are paraphrasing "The function names are those used for special
class methods;
On Wed, Oct 8, 2014, at 15:38, Ethan Furman wrote:
> LOL, no kidding! The main reason I bother using the operator module is
> for the readability of not seeing the dunders,
> and the writability of not having to type them.
I'm not sure what situation you would have to type them (as opposed to
On 10/08/2014 12:09 PM, Terry Reedy wrote:
On 10/8/2014 6:57 AM, Steven D'Aprano wrote:
According to the documentation, operator.__add__ is the "official" function,
and operator.add is just there for convenience.
You are paraphrasing "The function names are those used for special class
metho
On 10/8/2014 6:57 AM, Steven D'Aprano wrote:
According to the documentation, operator.__add__ is the "official" function,
and operator.add is just there for convenience.
You are paraphrasing "The function names are those used for special
class methods; variants without leading and trailing __
marco.naw...@colosso.nl wrote:
> For me it makes sense. operator.add should be used in a "global" context
> (I don't know how to express it otherwise). So you provide it with the
> two values that you want to add. The .__add__ variants are bound to a
> particular instance and you provide it with a
(You didn't include any context in your post. Please quote as much
text as would be helpful; it's the easiest way to show what you're
talking about.)
On Wed, Oct 8, 2014 at 7:46 PM, wrote:
> For me it makes sense. operator.add should be used in a "global" context
> (I don't know how to express i
For me it makes sense. operator.add should be used in a "global" context
(I don't know how to express it otherwise). So you provide it with the
two values that you want to add. The .__add__ variants are bound to a
particular instance and you provide it with a single value that you want
to add.
Y
On 10/7/2014 9:41 PM, Steven D'Aprano wrote:
Every Python operator has a function version in the operator module:
operator + has function operator.add;
operator - has function operator.sub;
operator * has function operator.mul;
and so forth. Only, that's not quite right... according to the
docu
Every Python operator has a function version in the operator module:
operator + has function operator.add;
operator - has function operator.sub;
operator * has function operator.mul;
and so forth. Only, that's not quite right... according to the
documentation, the "official" functions are actuall
19 matches
Mail list logo