I am calling a method on an object and I want the returned value to be assigned to the object itself. Is there a proper programming idiom for this?
The example I am using is this:
d = "2007-07-18 10:03:19"
d.split()[0]
However split doesn't change the original.
The other way:
d = d.split()[0]
Seems rather clunky. Is there a cleaner way or is this just the way it is?