Archive for February, 2009
Things that are wrong with Python (3): destructive functions
Thursday, February 12th, 2009Pythons's sort and append functions mutate the sequence they work on. This is wrong. Rather than write x = list.append(1).sort() you have to write: x = list[:] x.append(1) x.sort()
Things that are wrong with Python (2): return values
Thursday, February 12th, 2009Python doesn't return values by default. This is wrong. The last value should always be returned.
Things That Are Wrong with Python (1): True and False
Thursday, February 12th, 2009The following values are all false in Python programming language. None False numbers equal to 0: 0, 0L, 0.0, 0j empty sequences:e.g., '"", (), [], array.array('i') empty maps: e.g., {} any object that defines a __nonzero__ or __len__ method (returning False or len=0, respectively This is a Thing that is Wrong with Python. (The Right Way: false is ...