In the process of refactoring some code, I serendipitously created what I think 
is an essential new bit of Python syntax.  The “or else” statement.  I ended up 
with:

        sites_string = args.sites or else self.config['sites']

which, of course, is a syntax error today, but it got me thinking what we could 
do with an “or else” construct.  Perhaps an alternative to assertions?  
Wouldn’t it be neat to write:

   foo == 42 or else

and have that be an synonym for:

    assert foo == 42

:-)

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to