[Python-Dev] binary operation heuristics -- bug or undocumented?

2010-03-19 Thread Alex A. Naanou
Hi, A friend of mine stumbled upon the following behavior: ---cut--- >>> class A(object): pass ... >>> class B(object): ... def __add__(self, other): ... print 'B: adding B and %s objects.' % other.__class__.__name__ ... >>> class C(object): ... def __radd__(self, other): ...

Re: [Python-Dev] binary operation heuristics -- bug or undocumented?

2010-03-19 Thread Alex A. Naanou
Thanks! On Fri, Mar 19, 2010 at 16:05, Michael Foord wrote: > On 19/03/2010 12:46, Alex A. Naanou wrote: >> >> [snip...] >>>>> >>>>> class C(object): >>>>> >> >> ...     def __radd__(self, other): >&

[Python-Dev] inconsistency when swapping obj.__dict__ with a dict-like object...

2005-04-05 Thread Alex A. Naanou
Hi! here is a simple piece of code ---cut--- class Dict(dict): def __init__(self, dct={}): self._dict = dct def __getitem__(self, name): return self._dct[name] def __setitem__(self, name, value): self._dct[name] = value def __delitem__(self, name):

[Python-Dev] odd "tuple does not support assignment" confusion...

2012-03-02 Thread Alex A. Naanou
Hi everyone, Just stumbled on a fun little thing: We create a simple structure... l = ([],) Now modify the list, and... l[0] += [1] ...we fail: ## Traceback (most recent call last): ## File "F:\work\ImageGrid\cur\ImageGrid\src\test\python-bug.py", line 17, in ## l[0] += [1] ## Ty

Re: [Python-Dev] odd "tuple does not support assignment" confusion...

2012-03-02 Thread Alex A. Naanou
I knew this was a feature!!! features such as these should be fixed! %) On Sat, Mar 3, 2012 at 03:38, R. David Murray wrote: > On Sat, 03 Mar 2012 03:06:33 +0400, "Alex A. Naanou" > wrote: >> Hi everyone, >> >> Just stumbled on a fun little thing: