> Sorry, I didn't mean to mislead. I wrote "easily" - I guess using the > current textwrap.dedent isn't really hard, but still, writing: > > import textwrap > .... > > r = some_func(textwrap.dedent('''\ > line1 > line2''')) > > Seems harder to me than simply > > r = some_func('''\ > line1 > line2'''.dedent()) > > This example brings up another reason why "dedent" us a method is a > good idea: It is a common convention to indent things according to the > last opening bracket. "dedent" as a function makes the indentation > grow in at least 7 characters, and in 16 characters if you don't do > "from textwrap import dedent". It's a common convention, but a rather ugly one. It makes harder breaking lines at 78-80 chars, and using long enough identifiers. I find it more useful to go straight to the next line, indenting the usual four spaces (and also separating nested stuff): r = some_func( textwrap.dedent( '''\ line1 line2''')) This style uses up more vertical space, but I find it also gives code a clearer overall shape. -- Nicola Larosa - nico at tekNico.net Use of threads can be very deceptive. [...] in almost all cases they also make debugging, testing, and maintenance vastly more difficult and sometimes impossible. http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html#why
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