In article <mailman.16498.1417544472.18130.python-l...@python.org>, Chris Angelico <ros...@gmail.com> wrote:
> On Wed, Dec 3, 2014 at 4:41 AM, Zachary Ware > <zachary.ware+pyl...@gmail.com> wrote: > > On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith <r...@panix.com> wrote: > >> Wouldnât it be neat to write: > >> > >> foo == 42 or else > >> > >> and have that be an synonym for: > >> > >> assert foo == 42 > >> > >> :-) > > > > Never going to happen, but I like it! Perhaps raise IntimidationError > > instead of AssertionError when it fails? > > Definitely. That's what I first thought, when I saw the subject line. > > Additionally, whenever this construct is used, the "yield" statement > (expression, whatever) will be redefined to yield to intimidation and > make the statement true, whatever it takes. In the above example, > "yield" would decide which out of foo and 42 is more amenable to > change, and altering it to be equal to the other. (It may also find > that == is the most amenable, and alter its definition such that foo > and 42 become equal.) > > ChrisA This could be handy in the field of forensic accounting.
-- https://mail.python.org/mailman/listinfo/python-list