python3: 'where' keyword

Nick Coghlan ncoghlan at iinet.net.au
Sat Jan 8 01:42:16 EST 2005


Nick Coghlan wrote:
> It also allows the necessary but uninteresting setup for an expression 
> to be moved "out of the way", bringing the expression that does the real 
> work to prominence.

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"

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list