Movatterモバイル変換
[0]ホーム
[Python-ideas] Transportable indent level markers. >>>===<<<
Jim Jewettjimjjewett at gmail.com
Thu Dec 15 16:33:08 CET 2011
On Thu, Dec 15, 2011 at 12:25 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:> (And I freely admit that my suggestion is also quite ugly. However,> the status quo, with everyone inventing assorted templating languages> for use with Python that are largely independent of Python itself> already sucks)Guido actually endorsed ugly if it is just used for transport. Thatsaid, for embedding in a template, I would prefer to avoid ugly. Butwhy does it have to be all punctuation?:indent 4 if is_frobbable(user, request)::indent 5 frob(request):indent 4 else::indent 5 spit_error("Can't frob here, mate!")The grammar would be that at the start of a (line, string, whateverrecord marker the embedding environment has), the literal ":indent" followed by whitespace followed by a decimal number <count> followed by whitespace followed by a line of python codewould be equivalent to that same line of python code indented <count>times. Ideally, the actual leading whitespace would also demonstrateproper indenting, but it wouldn't *need* to, so the code would berobust against transmission.-jJ
More information about the Python-ideasmailing list
[8]ページ先頭