python3: 'where' keyword

Carlos Ribeiro carribeiro at gmail.com
Sun Jan 9 03:51:42 EST 2005


On Sun, 09 Jan 2005 15:54:08 +1000, Nick Coghlan <ncoghlan at iinet.net.au> wrote:
> Here's another nice one if 'where' is added to compound statements as well:
> 
> @dbc(pre, post)
> def foo():
>    pass
> where:
>    def pre():
>      pass
>    def post():
>      pass

Interesting. It solves some of the issues with chosing a clear syntax
for "design by contract" and other similar features that were being
debated lately. I also thought about his one:

! def foo(x=calculate_default_value()):
!     pass
! where:
!     def calculate_default_value():
!         ...
!         return <something>


-- 
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: carribeiro at gmail.com
mail: carribeiro at yahoo.com



More information about the Python-list mailing list