Fix Python – Why doesn’t a python dict.update() return the object?

I ‘m trying to do :
award_dict = {
“url” : “http://facebook.com”,
“imageurl” : “http://farm4.static.flickr.com/3431/3939267074_feb9eb19b1_o.png”,
“count” : 1,
}

def award(name, count, points, desc_string, my_size, parent) :
if my_size > count :
a = {
“name” : name,
“description” : desc_string % coun….

Fix Python – Why doesn’t Python have a sign function?

I can’t understand why Python doesn’t have a sign function. It has an abs builtin (which I consider sign’s sister), but no sign.
In python 2.6 there is even a copysign function (in math), but no sign. Why bother to write a copysign(x,y) when you could just write a sign and then get the copysign directly from abs(x) * sign(y)? The latter would be m….

[Fixed] python – “Least Astonishment” and the Mutable Default Argument

Anyone tinkering with Python long enough has been bitten (or torn to pieces) by the following issue:
def foo(a=[]):
a.append(5)
return a

Python novices would expect this function to always return a list with only one element: [5]. The result is instead very different, and very astonishing (for a novice):
>>> foo()
[5]
>>> foo()
[5, 5]
>>>….