from __future__ import braces is just an easter egg... ...and shouldn't
it better state from __past__ import braces ;-)
Anyway, as far as I know the IPython interpreter can recognize lines
ending in ‘:’ and indent the next line, while also un-indenting
automatically after ‘raise’ or ‘return’.
On Wed, 31 Jul 2013 10:45:36 +0700, Musical Notation wrote:
> Is there any script that converts indentation in Python code to curly
> braces? The indentation is sometime lost when I copy my code to an
> application or a website.
Complain to the website or application that it is throwing away
sig
On Wed, Jul 31, 2013 at 3:07 PM, Rotwang wrote:
>> # Assumes spaces OR tabs but not both
>> # Can't see an easy way to count leading spaces other than:
>> # len(s)-len(s.lstrip())
>
>
> How about len(s.expandtabs()) - len(s.lstrip()) instead?
Still comes to the same thing. The only diff is that t
So, why do you want to do this? As has been pointed out, its a
difficult and likely sizable task to build such a parser. In the end
you get something that isn't a computer language -- even tho it looks
like one. And it also is probably just as big a job to convert it
back to python. So, what is
On 31/07/2013 14:55, Chris Angelico wrote:
[...]
Since the braced version won't run anyway, how about a translation like this:
def foo():
print("""Hello,
world!""")
for i in range(5):
foo()
return 42
-->
0-def foo():
4-print("""Hello,
0-world!""")
4-for i in range(5):
On Wed, Jul 31, 2013 at 1:39 PM, Beth McNany wrote:
> ok, ok, if you *really* want it, you could keep track of how many leading
> spaces there are (you are using spaces, right?), and insert an open bracket
> where that number increases and a closing bracket where it decreases. Of
> course, as wit
On Jul 31, 2013, at 19:27, IshIsh wrote:
> Try from __future__ import braces as the first line of a source file (or
> typing it in an interactive session), and watch the interpreter's
> response...
"SyntaxError: not a chance" I already know that.--
http://mail.python.org/mailman/listinfo/p
31.07.13 06:45, Musical Notation написав(ла):
Is there any script that converts indentation in Python code to curly braces?
The indentation is sometime lost when I copy my code to an application or a
website.
Look at the pindent.py script.
--
http://mail.python.org/mailman/listinfo/python-li
Musical Notation:
Is there any script that converts indentation in Python code to curly braces?
The indentation is sometime lost when I copy my code to an application or a
website.
pindent.py in the Tools/Scripts directory of Python installations
does something similar by adding or removi
from __future__ import braces ;)
ok, ok, if you *really* want it, you could keep track of how many leading
spaces there are (you are using spaces, right?), and insert an open bracket
where that number increases and a closing bracket where it decreases. Of
course, as with all parsing problems, thi
On Tue, Jul 30, 2013 at 11:45 PM, Musical Notation
wrote:
> Is there any script that converts indentation in Python code to curly braces?
> The indentation is sometime lost when I copy my code to an application or a
> website.
I guess you could google that.
What do you mean that indentation is
Is there any script that converts indentation in Python code to curly braces?
The indentation is sometime lost when I copy my code to an application or a
website.
--
http://mail.python.org/mailman/listinfo/python-list
12 matches
Mail list logo