A
andrew cooke
Context - http://docs.python.org/3.0/reference/datamodel.html?highlight=data
model#object.__iadd__
Just a suggestion I thought I'd throw out... There's a restriction in
the language implementation on exactly what can go the left of an
augmented arithmetic expression.
For example:
is ok, but:.... def __init__():
.... self.a = 3
.... def __ipow__(self, x):
.... self.a **= x
.... File "<stdin>", line 1
SyntaxError: illegal expression for augmented assignment
Now unless I've done something stupid above (always a possibility )
the implementation seems a bit strict (is it really a *syntax* error?
- I am not sure exactly what the restriction is).
This may seems like a small issue, but operators can really help with
making embedded DSLs in Python - they give quite a bit of "wiggle
room" to invent a syntax that is compact and intuitive. The
restriction above cuts into that (OK, so it's still a small
issue... )
Cheers,
Andrew
model#object.__iadd__
Just a suggestion I thought I'd throw out... There's a restriction in
the language implementation on exactly what can go the left of an
augmented arithmetic expression.
For example:
is ok, but:.... def __init__():
.... self.a = 3
.... def __ipow__(self, x):
.... self.a **= x
.... File "<stdin>", line 1
SyntaxError: illegal expression for augmented assignment
Now unless I've done something stupid above (always a possibility )
the implementation seems a bit strict (is it really a *syntax* error?
- I am not sure exactly what the restriction is).
This may seems like a small issue, but operators can really help with
making embedded DSLs in Python - they give quite a bit of "wiggle
room" to invent a syntax that is compact and intuitive. The
restriction above cuts into that (OK, so it's still a small
issue... )
Cheers,
Andrew