Aahz wrote:
In article mailman.7801.1232715276.3487.python-l...@python.org,
Steve Holden st...@holdenweb.com wrote:
I understand what you are saying, but if the id() associated with a name
doesn't change after augmented assignment it seems a little wrong-headed
to argue that the augmented
a...@pythoncraft.com (Aahz) writes:
Actually, that is not correct.
You're right, evidently.
[snip]
a
(1, ['foo', 'bar'], 'xyzzy')
a[1] += ['spam']
Traceback (most recent call last):
File stdin, line 1, in ?
TypeError: object doesn't support item assignment
a
(1, ['foo', 'bar',
Aahz wrote:
In article 87hc3un1vn.fsf@metalzone.distorted.org.uk,
Mark Wooding m...@distorted.org.uk wrote:
* Python augmented-assignment (`+=', for example) is inconsistent.
Depending on what type of object the left-hand side evaluates to, it
may /either/ mutate that object, /or/
In article mailman.7801.1232715276.3487.python-l...@python.org,
Steve Holden st...@holdenweb.com wrote:
I understand what you are saying, but if the id() associated with a name
doesn't change after augmented assignment it seems a little wrong-headed
to argue that the augmented assignment always
In article 87hc3un1vn.fsf@metalzone.distorted.org.uk,
Mark Wooding m...@distorted.org.uk wrote:
* Python augmented-assignment (`+=', for example) is inconsistent.
Depending on what type of object the left-hand side evaluates to, it
may /either/ mutate that object, /or/ assign a new
Steven D'Aprano ste...@remove.this.cybersource.com.au writes:
There's a practical reason too. You create a new Foo instance, mutate
it with the augmented assignment operator, and then a tenth of a
millisecond later the garbage collector throws it away because it has
a reference count of zero.
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:
a = 3
a **=
On Sun, Jan 18, 2009 at 2:56 AM, andrew cooke and...@acooke.org wrote:
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
Therefore, Python requires you to rewrite the code in some other way
that makes your intentions more clear. For instance, why not use the
operator instead?
Right, but you're guessing what the context is. Within a DSL it often
makes a lot of sense to use operators for reasons that weren't
On Sun, Jan 18, 2009 at 3:42 AM, andrew cooke and...@acooke.org wrote:
Therefore, Python requires you to rewrite the code in some other way
that makes your intentions more clear. For instance, why not use the
operator instead?
Right, but you're guessing what the context is. Within a DSL it
Not sure if you were saying this, but the underlying technical reason
for this issue is that they are treated as assignment rather than
operators in the language spec -
http://docs.python.org/3.0/reference/simple_stmts.html#augmented-assignment-statements
I think this explains why they are not
On Jan 18, 9:01 am, Chris Rebert c...@rebertia.com wrote:
Indeed. Python happens to in this case draw the line at using the
augmented assignment operators for non-assignment. I personally see
this as reasonable because the = symbol has a consistent meaning in
Python (assignment) whereas the
On Sun, 18 Jan 2009 04:24:04 -0800, andrew cooke wrote:
my argument was that *= is not treated as = and *, but as a completely
new operator (the docs even say that the implementation need not return
self which suggests some pretty extreme semantics were envisaged).
What do you mean by
On Jan 18, 9:40 am, Marc 'BlackJack' Rintsch bj_...@gmx.net wrote:
On Sun, 18 Jan 2009 04:24:04 -0800, andrew cooke wrote:
my argument was that *= is not treated as = and *, but as a completely
new operator (the docs even say that the implementation need not return
self which suggests some
On Jan 18, 9:56 am, andrew cooke and...@acooke.org wrote:
either i have misundertstood you
ah, i see your point. sorry, andrew
--
http://mail.python.org/mailman/listinfo/python-list
http://bugs.python.org/issue4986
Sorry for the noise,
Andrew
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 18, 6:56 am, andrew cooke and...@acooke.org wrote:
On Jan 18, 9:40 am, Marc 'BlackJack' Rintsch bj_...@gmx.net wrote:
On Sun, 18 Jan 2009 04:24:04 -0800, andrew cooke wrote:
my argument was that *= is not treated as = and *, but as a completely
new operator (the docs even say that
Improved link -
http://docs.python.org/3.0/reference/datamodel.html#object.__iadd__
--
http://mail.python.org/mailman/listinfo/python-list
andrew cooke wrote:
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
On Sun, 18 Jan 2009 15:11:46 -0500, Terry Reedy wrote:
andrew cooke wrote:
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
20 matches
Mail list logo