Guido van Rossum wrote:
On 8/10/06, James Y Knight [EMAIL PROTECTED] wrote:
It makes just as much sense as assigning to an array access, and the
semantics would be pretty similar.
No. Array references (x[i]) and attribute references (x.a) represent
locations. Function calls represent
On 8/11/06, Neal Becker [EMAIL PROTECTED] wrote:
Guido van Rossum wrote:
On 8/10/06, James Y Knight [EMAIL PROTECTED] wrote:
It makes just as much sense as assigning to an array access, and the
semantics would be pretty similar.
No. Array references (x[i]) and attribute references
Neal Becker schrieb:
No. Array references (x[i]) and attribute references (x.a) represent
locations. Function calls represent values. This is no different
than the distinction between lvalues and rvalues in C.
Except this syntax is valid in c++ where X() is a constructor call:
At 09:40 PM 8/11/2006 +0200, Martin v. Löwis wrote:
Michael Urman schrieb:
On 8/9/06, Michael Hudson [EMAIL PROTECTED] wrote:
The question doesn't make sense: in Python, you assign to a name,
an attribute or a subscript, and that's it.
Just to play devil's advocate here, why not to a
Phillip J. Eby schrieb:
Actually, this isn't as hard as you're implying. In at least the
compiler.ast package, such an operation would be represented as a
CallFunc node as the child of an Assign node. Wrapping the call node's
main child expression in a Getattr for __setcall__ would then
Neal Becker schrieb:
1) Should assignment to a temporary object be allowed?
Unlike Michael, I think the question does make sense, and
the answer is no, for the reason Michael gave: you assign
to names, not to objects.
2) Should the syntax for creation of a temporary object be a constructor
Michael Urman [EMAIL PROTECTED] wrote:
On 8/9/06, Michael Hudson [EMAIL PROTECTED] wrote:
The question doesn't make sense: in Python, you assign to a name,
an attribute or a subscript, and that's it.
Just to play devil's advocate here, why not to a function call via a
new __setcall__?
On Aug 10, 2006, at 12:01 PM, Josiah Carlson wrote:
Michael Urman [EMAIL PROTECTED] wrote:
On 8/9/06, Michael Hudson [EMAIL PROTECTED] wrote:
The question doesn't make sense: in Python, you assign to a name,
an attribute or a subscript, and that's it.
Just to play devil's advocate here,
On 8/10/06, James Y Knight [EMAIL PROTECTED] wrote:
It makes just as much sense as assigning to an array access, and the
semantics would be pretty similar.
No. Array references (x[i]) and attribute references (x.a) represent
locations. Function calls represent values. This is no different
than
At 09:24 AM 8/10/2006 -0700, Guido van Rossum wrote:
On 8/10/06, James Y Knight [EMAIL PROTECTED] wrote:
It makes just as much sense as assigning to an array access, and the
semantics would be pretty similar.
No. Array references (x[i]) and attribute references (x.a) represent
locations.
On Aug 10, 2006, at 12:19 PM, James Y Knight wrote:
Please note I'm actually arguing for this proposal. Just agreeing
that it is not a completely nonsensical idea.
ERK! Big typo there. I meant to say:
Please note I'm NOT*** actually arguing for this proposal.
Sorry for any confusion.
Phillip J. Eby [EMAIL PROTECTED] wrote:
At 09:24 AM 8/10/2006 -0700, Guido van Rossum wrote:
On 8/10/06, James Y Knight [EMAIL PROTECTED] wrote:
It makes just as much sense as assigning to an array access, and the
semantics would be pretty similar.
No. Array references (x[i]) and
On Aug 10, 2006, at 12:24 PM, Guido van Rossum wrote:
On 8/10/06, James Y Knight [EMAIL PROTECTED] wrote:
It makes just as much sense as assigning to an array access, and the
semantics would be pretty similar.
No. Array references (x[i]) and attribute references (x.a) represent
locations.
On 8/10/06, James Y Knight [EMAIL PROTECTED] wrote:
On Aug 10, 2006, at 12:24 PM, Guido van Rossum wrote:
On 8/10/06, James Y Knight [EMAIL PROTECTED] wrote:
It makes just as much sense as assigning to an array access, and the
semantics would be pretty similar.
No. Array references
At 12:28 PM 8/10/2006 -0700, Guido van Rossum wrote:
On Aug 10, 2006, at 12:31 PM, Phillip J. Eby wrote:
Honestly, it might make more sense to get rid of augmented
assignment in Py3K rather than to add this. It seems that the need
for something like this springs primarily from the existence
On 8/10/06, Phillip J. Eby [EMAIL PROTECTED] wrote:
That being said, the benefit of hypergeneralizing assignment seems small
compared to its price. So eliminating augmented assignment seems a more
attractive way to get rid of the nuisance of the perennially repeated
proposals to fix or
On Aug 10, 2006, at 4:57 PM, Phillip J. Eby wrote:
However, I'm also not clear that trying to assign to a function
call *is* ill-advised. One of the things that attracted me to
Python in the first place is that it had a lot of features that
would be considered hypergeneralization in
class X (object):
pass
X() += 2
SyntaxError: can't assign to function call
Suppose I actually had defined __iadd__ for class X. Python says this
syntax is invalid. I wish is wasn't.
Here's where I might use it. Suppose I have a container class. Suppose I
could make a slice of this
Neal Becker [EMAIL PROTECTED] wrote:
class X (object):
pass
X() += 2
SyntaxError: can't assign to function call
[snip]
Does anyone else think this would be a good addition to Python?
No. += implies assignment. As the syntax error states, can't assign
to function call.
-1
-
Neal Becker [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
class X (object):
pass
X() += 2
SyntaxError: can't assign to function call
Suppose I actually had defined __iadd__ for class X. Python says this
syntax is invalid. I wish is wasn't.
If you translate to x() = x()
Neal Becker [EMAIL PROTECTED] writes:
1) Should assignment to a temporary object be allowed?
The question doesn't make sense: in Python, you assign to a name,
an attribute or a subscript, and that's it.
Cheers,
mwh
--
exarkun I think there's a rather large difference between a stale
Terry Reedy wrote:
Neal Becker [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
class X (object):
pass
X() += 2
SyntaxError: can't assign to function call
Suppose I actually had defined __iadd__ for class X. Python says this
syntax is invalid. I wish is wasn't.
If you
On 8/9/06, Georg Brandl [EMAIL PROTECTED] wrote:
Terry Reedy wrote:
Neal Becker [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
class X (object):
pass
X() += 2
SyntaxError: can't assign to function call
Suppose I actually had defined __iadd__ for class X. Python
Guido van Rossum wrote:
This is similar to
x = ([1], 2)
x[0] += [2]
which doesn't currently work either, though it could.
No it couldn't. You can't assign to x[0]. L += R is defined as L =
L.__iadd__(R) so L must be a valid assignment target.
Thanks for making that clear. I actually
24 matches
Mail list logo