Hay I got a better idea. If you put two dots (..) on a line by itself it means<br>execute the previous line again!<br><br><div class="gmail_quote">On 1 May 2010 07:08, Patrick Maupin <span dir="ltr"><<a href="mailto:pmaupin@gmail.com">pmaupin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">On Apr 30, 11:04 am, Jabapyth <<a href="mailto:jabap...@gmail.com">jabap...@gmail.com</a>> wrote:<br>
> At least a few times a day I wish python had the following shortcut<br>
> syntax:<br>
><br>
> vbl.=func(args)<br>
><br>
> this would be equivalent to<br>
><br>
> vbl = vbl.func(args)<br>
><br>
> example:<br>
><br>
> foo = "Hello world"<br>
> foo.=split(" ")<br>
> print foo<br>
> # ['Hello', 'world']<br>
><br>
> and I guess you could generalize this to<br>
><br>
> vbl.=[some text]<br>
> #<br>
> vbl = vbl.[some text]<br>
><br>
> e.g.<br>
><br>
> temp.=children[0]<br>
> # temp = temp.children[0]<br>
><br>
> thoughts?<br>
<br>
</div>First thought: good luck getting something like this through.<br>
Probably not going to happen, although I do find the idea very<br>
intriguing.<br>
<br>
Second thought: I don't like the proposed syntax at all.<br>
<br>
+=, -=, /=, *=, etc. conceptually (and, if lhs object supports in-<br>
place operator methods, actually) *modify* the lhs object.<br>
<br>
Your proposed .= syntax conceptually *replaces* the lhs object<br>
(actually, rebinds the lhs symbol to the new object).<br>
<br>
If this were to be deemed worthy of the language, I would think a<br>
better syntax would be something like:<br>
<br>
mystring = .upper()<br>
mystring = .replace('a', 'b')<br>
<br>
etc.<br>
<br>
The '=' shows clearly that mystring is being rebound to a new object.<br>
<br>
As Steven has shown, '.' functions as an operator, so if this change<br>
were accepted, in reality you would probably be able to write:<br>
<br>
mystring = . upper()<br>
mystring=.upper()<br>
<br>
or whatever. But the canonical form would probably be with a space<br>
before the period but not after.<br>
<br>
Regards,<br>
Pat<br>
<div><div></div><div class="h5">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></blockquote></div><br>