Learning Python on jEdit

David Rushby woodsplitter at rocketmail.com
Tue Feb 24 10:01:12 CET 2004


rtjoseph at ev1.net (Ray) wrote in message news:<d422a60.0402231132.19acdc74 at posting.google.com>...
> I want to jump in a learn Python.  I have spent about a day looking at
> editors and IDEs and (probably prematurely) selected jEdit to work in.
> I have downloaded Python and jEdit.

Even though I love jEdit, its Python-awareness isn't as good as that
of a Python-specific IDE.  Since you're in the process of learning
Python, I recommend that you use as your interactive console an editor
that has Python object member pop-ups and parameter tips (e.g.,
Pythonwin, or OrbTech's PyShell (which comes with wxPython)).  I use
PyShell as my interactive console and jEdit as my main editor.

I edit Python and C/C++ source code for many hours a day with jEdit,
and have been doing so since 1999, so obviously I regard jEdit as a
suitable editor for Python source.  IMO, jEdit's most compelling
(though not unique) features are code folding, HyperSearch, multiple
views/split views, and markers.  My workstation has multiple monitors,
and I can spread several semi-autonomous 'views' from a single
instance of jEdit across them to simultaneously view several pieces of
code at once.  Markers (with appropriate Back/Set/Forward keyboard
shortcuts) allow me to hop around huge source files without touching
the mouse.

> I have been going over jEdit for a while and can't real see how to get it 
> to know that I am using Python.

In the Utilities->Global Options->Editing dialog (of jEdit 4.1), you
can change Python-specific settings by selecting 'Python' from the
'Change settings for mode' drop-down.  I have mine set to 'Tab width':
4, 'Indent width': 4, 'Soft (emulated with spaces) tabs': yes.  Save
yourself some hassle and don't mix tabs and spaces in your Python
source code.  jEdit can paper over the difference between soft and
hard tabs, so there are no extra keypresses required.

This dialog also allows you to specify which filename extensions are
to be considered Python source files, or which textual pattern on the
first line of a source file indicates same (e.g., '#/usr/bin/env
python').

If you use jEdit for virtually nothing other than editing Python
source, you can set Python mode as the default via the 'Default Edit
Mode' option in that same Utilities->Global Options->Editing dialog.

> So there is more there than I expected.  Any suggestions on how to
> configure (plugg-ins?) for jEdit and learn Python?

jEdit's indentation-based code folding works very well with Python out
of the box.

Since Python has syntactically significant whitespace, jEdit's
Whitespace plugin is a real help.  In particular, turn on
Utilities->Global Options->Plugins->Whitespace->Fold guides->Show fold
guides by default.  I have Whitespace set to display a faint grey
vertical line along Python indentation planes.

jEdit also has a Jython plugin, which, among other capabilities,
allows you to write jEdit macros in Python.  There's also a plugin
called Py Utils, but I haven't used it.



More information about the Python-list mailing list