3 ms·
Agree. Even better, though: # 4 def length(): return math.sqrt(.x**2 + .y**2 + .z**2) Ambiguity and "pseudo-keyword" are both gone! [EDITED code
by fnl 10y ago
Agree. Even better, though:
# 4
def length():
return math.sqrt(.x**2 + .y**2 + .z**2)
Ambiguity and "pseudo-keyword" are both gone!
[EDITED code for better readability]
- pyrale 10y agoIf you mind with self being too bloated, you can already change it to what you like. The `self` is merely idiomatic. def length(s): return math.sqrt(s.x**2 + s.y**2 + s.z**2) The beauty with self in Python is that self is not at all magic : it merely indicates that the object instance you're using will be passed as first argument of the class method. Also you can get a custom font with typographic ligatures (e.g. for self, lambda, and so on) in order to make it more visually appealing. For instance (self > 圖) : def length(圖): return math.sqrt(圖.x**2 + 圖.y**2 + 圖.z**2)