On Sat, Mar 28, 2009 at 10:37 AM, Florent Hivert
wrote:
> I also like the following one because it has a very high precedence and also
> because it reminds XML tags
>
> [1,2,3] [1,2,3]
That one is nice; it's very pretty. Unfortunately, it doesn't work
with the same implementation, because
> I'd like to extend the above decorator to handle several different
> common precedence levels, maybe just addition, multiplication, and power.
You mean that you what to support the following syntaxes ?
[1,2,3] +foo+ [1,2,3]
[1,2,3] **foo** [1,2,3]
I also like the following one becaus
Dear Jason,
> Okay, how about this:
>
> class inline_operator:
You probably mean :
class infix_operator:
...
"infix" remember "infix" :)
> # EXAMPLE
>
> a=[1,2,3]
> b=[3,4,5]
>
> @inline_operator
> def emul(a,b):
> return [i*j for i,j in zip(a,b)]
>
> # Returns [3,8,15]
> a
Florent Hivert wrote:
> Dear Jason,
>> Okay, how about this:
>>
>> class inline_operator:
>
> You probably mean :
>
> class infix_operator:
> ...
>
> "infix" remember "infix" :)
Yes. Right. Thanks.
>
>> # EXAMPLE
>>
>> a=[1,2,3]
>> b=[3,4,5]
>>
>> @inline_operator
>> def emul(a,b)
Carl Witty wrote:
> On Sat, Mar 28, 2009 at 5:28 AM, Jason Grout
> wrote:
>> Aha, the one custom infix operator that I know of in Sage.
>>
>> In the backslash operator and in the article posted, the rmul only
>> stored the argument and the __mul__ only performed the operation. Are
>> you always
On Sat, Mar 28, 2009 at 5:28 AM, Jason Grout
wrote:
> Aha, the one custom infix operator that I know of in Sage.
>
> In the backslash operator and in the article posted, the rmul only
> stored the argument and the __mul__ only performed the operation. Are
> you always guaranteed that __rmul__ wi
Robert Bradshaw wrote:
> This is the same trick we use for the backslash operator in Sage.
>
Aha, the one custom infix operator that I know of in Sage.
In the backslash operator and in the article posted, the rmul only
stored the argument and the __mul__ only performed the operation. Are
yo
Florent Hivert wrote:
>>> One thing that I thought was very interesting was their way of allowing
>>> for custom inline operators in python. It inspired the following
>>> @inline_operator decorator. Would this be useful in Sage?
>>>
>>> class inline_operator:
>>> def __init__(self, function)
> > One thing that I thought was very interesting was their way of allowing
> > for custom inline operators in python. It inspired the following
> > @inline_operator decorator. Would this be useful in Sage?
> >
> > class inline_operator:
> > def __init__(self, function):
> > self.fun
This is the same trick we use for the backslash operator in Sage.
- Robert
On Mar 27, 2009, at 6:52 PM, David Joyner wrote:
>
> This is very cool!
>
> I remember wanting something like this awhile back but right now I
> can't remember
> what for. Anyway, I think it could be useful. Thanks!
>
>
You're welcome to all of you. I guess all those hours spent online
didn't go to waste :)
Hazem
On Mar 27, 9:52 pm, David Joyner wrote:
> This is very cool!
>
> I remember wanting something like this awhile back but right now I
> can't remember
> what for. Anyway, I think it could be useful. Th
This is very cool!
I remember wanting something like this awhile back but right now I
can't remember
what for. Anyway, I think it could be useful. Thanks!
On Fri, Mar 27, 2009 at 9:16 PM, Jason Grout
wrote:
>
...
>
> One thing that I thought was very interesting was their way of allowing
> f
12 matches
Mail list logo