Python complaints

Brad Knotwell knotwell at ix.netcom.com
Tue Nov 23 22:43:58 EST 1999


Mark Carroll <markc at chiark.greenend.org.uk> writes:
> Basically, I'd be really interested to learn: what _don't_ people like
> about Python? Every language has things that many people complain
> about, however reasonably, or would like to have been different, and
> I'd be interested to know what Python's are so I can get an idea if
> any are going to annoy me, rather than me being confused then
> frustrated then disappointed about them as I discover them further
> in. For instance, I'm sure plenty of people would hate Modula-3's lack
> of implicit casting, need to define everything before using it,
> Pascal-style uppercase keywords, etc. Are there any ways that Python
> makes programming slightly more awkward than people would have liked?

In general, the only thing I've found annoying about Python are the scoping
rules:

>>> def fact(n):
..     def fact_iter(n,result):
..       if not n:  return result
..       else:      fact_iter(n-1,n*result)
..     return fact_iter(n,1)
.. 
>>> fact(3)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "<stdin>", line 5, in fact
  File "<stdin>", line 4, in fact_iter
NameError: fact_iter
>>>
>>> def curried_mult(x):
..     return lambda y: x*y
>>> curried_mult(3)
<function <lambda> at 80e2aa0>
>>> curried_mult(3)(4)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "<stdin>", line 2, in <lambda>
NameError: x
>>>

Similarly, the only thing I've found missing from Python is C's
ternary operator, it would be nice to be able to do something like 
the following:

def max(x,y): return ((x>y) ? x : y)

> -- Mark

Good luck.

--Brad




More information about the Python-list mailing list