
April 26, 2017
12:12 a.m.
On Wed, Apr 26, 2017 at 10:05 AM, Ryan Gonzalez <rymg19@gmail.com> wrote:
FWIW I always liked Dart's/Ruby's/Crystal's/(Coffee|Moon)Script's/WhateverElse's style:
class Cls { Cls(this.a); // IT'S MAGIC }
but the Python equivalent is admittedly weirder:
def ___init__(self, self.attr):
In a sense, what you have is this (modulo keyword arguments): def __init__(*args): self, self.attr = args which is perfectly legal, albeit weird. So it needn't actually be magic per se, just a change in the definition of an argument name (from NAME to whatever is legal as an assignment target). I don't think it's particularly useful, though. ChrisA