On Sat, 15 Jul 2000, Fredrik Lundh wrote: > Huaiyu Zhu wrote: > > Given what's quoted below, would you think . is the best choice? > > if what you're saying means that: > > >>> 1.+2. > 3.0 > > becomes: > > >>> 1.+2. > Traceback (innermost last): > File "<stdin>", line 1, in ? > TypeError: __dotadd__ nor __rdotadd__ defined for these operands > > it's clearly not a good choice. > > </F> > To quote from my c.l.py post: On Fri, 14 Jul 2000 11:38:51 -0600, Bjorn Pettersen <bjorn@roguewave.com> wrote: > >Well, this could actually be generally useful, but not with the .+ >syntax (since the dot would interfer with methods on the sequence >object). My impression from the python-dev list is that this is not the case. Some say it is easy to distinguish a. + b a .+ b Some say it is difficult. But the first is a syntax error anyway. The only real danger is 3. + a 3 .+ a But in this case pointwise operation does not make sense. So I suppose the following rules would resolve all the ambiguities: Dot binds with preceding number. Otherwise it binds with following operator. Otherwise it is a member indicator. Otherwise it is syntax error. Examples: 2.+b a.+b <-- only this is new a.b a.3 Huaiyu
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4