On Thursday, August 8, 2013 3:04:30 AM UTC-5, Terry Reedy wrote:
> I cannot help but note that this is *more* typing. But anyhow, something 

It wasn't so much about the typing so much as having "test" in front of 
everything.  It's a problem particular to me since I'm writing code that, well, 
runs experiments.  So the word "test" is already all over the place.  I would 
even prefer if I could do away with assuming everything starting with "test" is 
a unittest, but I didn't think I could; it looks like Peter Otten got me in the 
right direction.

> like this might work.
> 

> def test(f):
> 
>      f.__class__.__dict__['test_'+f.__name__]
> 
> 
> 
> might work. Or maybe for the body just
> 
>     setattr(f.__class__, 'test_'+f.__name__)
> 

Just for giggles I can mess around with those exact lines, but I did get 
spanked trying to do something similar.  I couldn't reference __class__ for 
some reason (Python 2.7 problem?).
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to