Re: python3: 'where' keyword
AdSR <adsr@poczta.on et.pl> writes:[color=blue][color=green]
> > Killer app for this keyword:
> > class C(object):
> > x = property(get, set) where:
> > def get(self):
> > return "Silly property"
> > def set(self, val):
> > self.x = "Told you it was silly"[/color]
>
> Hey, this is super-elegant![/color]
Heh, even further:
z = C() where:
class C(object):
...
Lets you make anonymous classes and singleton objects.
AdSR <adsr@poczta.on et.pl> writes:[color=blue][color=green]
> > Killer app for this keyword:
> > class C(object):
> > x = property(get, set) where:
> > def get(self):
> > return "Silly property"
> > def set(self, val):
> > self.x = "Told you it was silly"[/color]
>
> Hey, this is super-elegant![/color]
Heh, even further:
z = C() where:
class C(object):
...
Lets you make anonymous classes and singleton objects.
Comment