On 21/09/2011 21.08, Michael Foord wrote: > On 21/09/2011 18:02, Stephen J. Turnbull wrote: >> Georg Brandl writes: >> >> > I don't think so. "skip if not" reads pretty well for me, while I >> > always have to think twice about "unless" -- may be a non-native- >> > speaker thing. >> >> FWIW, speaking as one native speaker, I'm not sure about that. "do ... >> if not condition" doesn't bother me, whether I think of the condition >> as an exception or as the normal state of affairs. I find "do ... >> unless condition" to be quite awkward if the condition is a normal >> state. > > I'm not a big fan of skipUnless, but there you go. I find "skip if > not" readable too and always have to "work out" what skipUnless means. > It's probably just that "if" and "if not" are such Python idioms and > "unless" isn't. I don't find it too readable in other contexts (e.g. failUnless), but I probably got used to skipUnless with the idiom: try: import foo except ImportError: foo = None @skipUnless(foo, 'requires foo') ... FWIW in Lib/test/support.py we have a "skip_unless_symlink", but the other two skipUnless have more readable names: "requires_zlib" and "requires_IEEE_754". In Lib/test/ "skipUnless" is used about 250 times, "skipIf" about 100. Best Regards, Ezio Melotti > > Michael > >
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4