[IronPython] pasting into interactive console cause double-indentation

Jim Hugunin Jim.Hugunin at microsoft.com
Tue Mar 14 19:59:01 CET 2006


Two things that I use to help with this are site.py and execfile.

Site.py is a Python file that will be automatically executed when you start IronPython.  It's a standard Python feature.  I use this to add the standard Python 2.4 directory to my path as well as to add refererences (using clr.AddReference) to frequently used assemblies.

Execfile will execute a file as if it was typed at the interactive prompt.  So you want have your standard code in a startup.py fille that you execute.

Let us know how these suggestions work out for you - Jim

________________________________
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Pete Sheill
Sent: Tuesday, March 14, 2006 8:03 AM
To: Discussion of IronPython
Subject: Re: [IronPython] pasting into interactive console cause double-indentation


Thanks for clearing that up.  Now I have a dilemma.  I love tab completion, but not auto-indent.  I also tend to run the same few commands every time I start up the interactive console to test something or other. E.g "import winforms".  One reason people love emacs and vim is that they are extremely configurable.  You can put your settings and startup commands in a config file (.emacs or .vimrc) that is loaded automatically.  I would like the same in the interactive console.

Thanks,
Pete


On 3/13/06, Shri Borde <Shri.Borde at microsoft.com<mailto:Shri.Borde at microsoft.com>> wrote:

"IronPythonConsole.exe -X:TabCompletion" supports auto-indentation so that you do not have to type the indentation for multi-line statements. This works nicely for interactive manual typing. However, if you paste text blocks (which will already have indentation in them), it will lead to double indentation as the console cannot detect if the text was typed in or pasted as a block.

The workaround is not to use -X:TabCompletion when you will be pasting in text.

We could support an option to enable or disable auto-indentation, but that would be yet another knob you have to deal with.

________

Do you want to help develop Dynamic languages on CLR?<http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038> ( http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)
________________________________

From: users-bounces at lists.ironpython.com<mailto:users-bounces at lists.ironpython.com> [mailto:users-bounces at lists.ironpython.com<mailto:users-bounces at lists.ironpython.com>] On Behalf Of Pete Sheill
Sent: Monday, March 13, 2006 10:07 AM
To: users at lists.ironpython.com<mailto:users at lists.ironpython.com>
Subject: [IronPython] pasting into interactive console

In Beta3, I recall being able to copy and paste large class definitions from my editor to the interactive console.  In Beta4, I get some strange indenting behavior that breaks that usage.  Example:

class Item(UserControl):
  def __init__(self, id, beetle):
    self.id<http://self.id/> = id
    self.Height = 50;

When pasted becomes...


>>> class Item(UserControl):
...       def __init__(self, id, beetle):
...               self.id<http://self.id/> = id
...                   self.Height = 50

and I get a SyntaxError.

My class definition has spaces, not tabs.   Is there some workaround?

Thanks.

-Pete

________________________________

Crush! Zap! Destroy! Junk e-mail trembles before the might of Windows Live(tm) Mail beta. Windows Live(tm) Mail beta<http://www2.imagine-msn.com/minisites/mail/Default.aspx?locale=en-us>

_______________________________________________
users mailing list
users at lists.ironpython.com<mailto:users at lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060314/4e81b8fa/attachment.html>


More information about the Ironpython-users mailing list