Indentation problem

I use Geany for wxpython programs.I run into problems mostly due to the fact that Geany stupidly behaves in regards to indentation.This happens only with wxpython programs though and not with other python programs.

nipun batra wrote:

I use Geany for wxpython programs.

I'd never heard of it, but from a quick perusal of the web page, it looks promising.

I run into problems mostly due to the fact that Geany stupidly behaves in regards to indentation.This happens only with wxpython programs though and not with other python programs.

wxPython is python -- I can't image how there could be a difference.

Anyway, it looks like you can configure geany to use only spaces for indentation -- the standard these days is 4 spaces for indentation, and it can't go wrong if you make sure nver to put a single tab in.

Very few editors do indentation right -- (X)Emacs is one, probably VI (I'm not sure). Of the editors written in Python, Peppy is the only one I've seen that does it right, but they all do OK. maybe the Geany developers would be open to suggestions.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

I started using Dr.Python seems much better and error free

Wingware's IDE also works right with indentation and has a converter
for spaces to tabs or vice-versa.

···

On Oct 3, 1:42 am, Christopher Barker <Chris.Bar...@noaa.gov> wrote:

nipun batra wrote:
> I use Geany for wxpython programs.

I'd never heard of it, but from a quick perusal of the web page, it
looks promising.

> I run into problems mostly due to the
> fact that Geany stupidly behaves in regards to indentation.This happens
> only with wxpython programs though and not with other python programs.

wxPython is python -- I can't image how there could be a difference.

Anyway, it looks like you can configure geany to use only spaces for
indentation -- the standard these days is 4 spaces for indentation, and
it can't go wrong if you make sure nver to put a single tab in.

Very few editors do indentation right -- (X)Emacs is one, probably VI
(I'm not sure). Of the editors written in Python, Peppy is the only one
I've seen that does it right, but they all do OK. maybe the Geany
developers would be open to suggestions.

-Chris

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Bar...@noaa.gov

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

GadgetSteve@live.co.uk wrote:

From: "Mike Driscoll" <kyosohma@gmail.com>

Very few editors do indentation right -- (X)Emacs is one, probably VI
(I'm not sure). Of the editors written in Python, Peppy is the only one
I've seen that does it right, but they all do OK.

Wingware's IDE also works right with indentation and has a converter
for spaces to tabs or vice-versa.

Textpad and Code::Blocks both work well for python provided you set use spaces instead of tabs and convert existing tabs to spaces.

I know I shouldn't take the bait, but I started it. I"ll be more specific about what I mean by "doing indentation right", and this applies to all languages, though it is particularly critical for Python.

As I said, most (and all written in Python) editors do OK, in the sense that they can make all your indentation 4 spaces, or all tabs, or whatever, if you set them right. Some are good about making sure you don't mix tabs and spaces. What is rare (and think remarkably valuable) is this:

* Re-mapping the <tab> key to "indent this line", rather than "put in a tab" or "put in 4 spaces" or "add one more level of indentation". Ideally hitting <tab> ANYWHERE on the line will indent that line correctly. With a delimited language, there is always ONE way to indent a line correctly (for a given style, anyway). For Python, it's not quite as simple, as there is no other indication of which block you want a given line to be part of. However if the tab key always puts the line in one of two places:
   - aligned with the line above
   - indented one if a new block is started (a colon)
It will be right most of the time and you can hit the delete key to move it back one if you want.

  - Indent continuation lines well -- if you have an un-closed parentheses, line up the next line with the start of the parens above.

* Re-mapping delete, so that if the cursor is in the "indentation space", it means: "remove one level of indentation".
  - if I'm indenting with 4 spaces, I really don't want to have to hit delete 4 times to un-indent a line!

Anyway, most editors don't do these things well, and you'd be amaze3d at how much easier to is to indent everything right when it does!

I did just give Wing a try, and it seems to do a nice job with this.

-Chris

···

On Oct 3, 1:42 am, Christopher Barker <Chris.Bar...@noaa.gov> wrote:

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

However if the tab key always puts the line in one of two places:
   - aligned with the line above
   - indented one if a new block is started (a colon)
It will be right most of the time and you can hit the delete key to move
it back one if you want.

FWIW the Zeus editor uses the 'aligned with the line above' option.

* Re-mapping delete, so that if the cursor is in the "indentation
space", it means: "remove one level of indentation".
  - if I'm indenting with 4 spaces, I really don't want to have to hit
delete 4 times to un-indent a line!

In this case Zeus does exactly what you describe in that one
backspace
will delete as much whitespace as is needed to align the text with
the
line above.

Jussi Jumppanen
Author: Zeus for Windows IDE
http://www.zeusedit.com (NOTE: Zeus is shareware)

···

On Oct 6, 4:59 am, Christopher Barker <Chris.Bar...@noaa.gov> wrote: