4 ms·
Here's an example: A co-worker looked at a function I wrote that converts a table to a tree, and he said to me, "I thought Python was supposed to be readable,
by undershirt 14y ago
Here's an example: A co-worker looked at a function I wrote that converts a table to a tree, and he said to me, "I thought Python was supposed to be readable, but I have no idea what this is doing."
See for yourself: https://gist.github.com/3988350 https://gist.github.com/3988350
- mattdeboard 14y agoI agree with your co-worker. The indirection is kind of annoying to follow to be completely honest, so if your co-worker isn't proficient in Python I can understand how this would seem impossible to sort out.
- Peaker 14y agoManually capturing free variables via: def __init__(self, x, y, ..): self.x = x self.y = y Is so tedious and DRY-violating.
- lmm 14y agoThis is true. I'd prefer scala-style constructor syntax - though I'm not sure how you could retain python's wonderful symmetry between constructors and methods, and the distinction between allocation and initialization.
- Peaker 14y agoI don't know Scala, but the Erights language does something like (pseudo-syntax): def Circle(center, radius): circumference = 2 * pi * radius return object: to getCircumference(): return circumference to ... The "self" is the lexical scope. Simple and more effective than Python's method, IMO.