Re: adding in-place operator to Python

2008-09-29 Thread Gabriel Genellina
En Thu, 25 Sep 2008 17:04:59 -0300, Arash Arfaee <[EMAIL PROTECTED]> escribió: Thank you very much Gerhard and Terry. I am trying to add undefined state to some Boolean operator. Here is what I tried to do and It is not working: class _3ph: def __init__(self): self.value = 0

Re: adding in-place operator to Python

2008-09-25 Thread Arash Arfaee
Thank you very much Gerhard and Terry. I am trying to add undefined state to some Boolean operator. Here is what I tried to do and It is not working: class _3ph: def __init__(self): self.value = 0 def __xor__(self,item): if self.value==2 or item==2: return 2

Re: adding in-place operator to Python

2008-09-23 Thread Terry Reedy
Arash Arfaee wrote: Hi All, Is there anyway to add new in-place operator to Python? Or is there any way to redefine internal in-place operators? Python does not have 'in-place operators'. It has 'augmented assignment statements' that combines a binary operation with an assignment. *If* th

Re: adding in-place operator to Python

2008-09-23 Thread Gerhard Häring
Arash Arfaee wrote: Hi All, Is there anyway to add new in-place operator to Python? You can't create new syntax, like %= Or is there any way to redefine internal in-place operators? What you can do is give your objects the ability to use these operators. See http://docs.python.org/ref/nu

adding in-place operator to Python

2008-09-23 Thread Arash Arfaee
Hi All, Is there anyway to add new in-place operator to Python? Or is there any way to redefine internal in-place operators? Thanks. Cheers, Arash -- http://mail.python.org/mailman/listinfo/python-list