[Python-ideas] Transportable indent level markers
Jim Jewett
jimjjewett at gmail.com
Thu Dec 15 16:39:56 CET 2011
On Thu, Dec 15, 2011 at 5:31 AM, Jeremy Sanders
<jeremy at jeremysanders.net> wrote:
> Oleg Broytman wrote:
>
>> <code>
>> <line indent="0">def foo():</line>
>> <line indent="1">a = 0</line>
>> <line indent="1">for i in range(10):</line>
>> <line indent="2">a += i</line>
>> <line indent="1">return a</line>
>> </code>
This would be awkward when the code is supposed to produce an
attribute value, so that entire elements are inside an element-open
tag.
> Nice. I'd like the option of JSON too, please, though the brackets
> might be a bit confusing :-)
If you're willing to wrap each line in a string, then leading
whitespace will already be preserved.
If you're not willing to wrap each line in a string, then it isn't
clear how JSON would represent the code part, regardless of how
indention is conveyed.
-jJ
More information about the Python-ideas
mailing list