opensuse - editor that does not eat out TAB characters

Maura Monville
2009-06-15T11:28:57+00:00


I have just learnt, to my dismay, that python syntax is sensitive to indent=
ation, even if python is supposed to be a modern language ...=0AI figured t=
hat out when I used Mac textEditor to copy some lines from a python script =
and paste them into the pdb text window for debugging.=0A=0ASince I will be=
 using SuSE systems to debug such a script, my question is:=0Ado you know o=
f an editor, running on SuSE, which does not cut off the precious indentati=
on characters making a mess of a python script ?=0AFor instance, Emacs won'=
t work for this particular problem.=0A=0ASome time ago I got an editor runn=
ing on Windows (on campus I had to use a Windows box) named "UltraEdit" (I =
am not sure the spelling is right).=0AIt was a very flexible editor tta cou=
ld be configured for performing very basic as well as very sophisticated ed=
iting functions.=0AI wonder whether something similar is available on Linux=
 platforms.=0A=0AThank you so much,=0AMaura=0A=0A=0A=0A      

Re: opensuse - editor that does not eat out TAB characters by Daniel Bauer on 2009-06-15T11:53:30+00:00
On Monday 15 June 2009 13:28:48, Maura Monville wrote:
> I have just learnt, to my dismay, that python syntax is sensitive to
> indentation, even if python is supposed to be a modern language ... I
> figured that out when I used Mac textEditor to copy some lines from a
> python script and paste them into the pdb text window for debugging.
>
> Since I will be using SuSE systems to debug such a script, my question is:
> do you know of an editor, running on SuSE, which does not cut off the
> precious indentation characters making a mess of a python script ? For
> instance, Emacs won't work for this particular problem.
>
> Some time ago I got an editor running on Windows (on campus I had to use a
> Windows box) named "UltraEdit" (I am not sure the spelling is right). It
> was a very flexible editor tta could be configured for performing very
> basic as well as very sophisticated editing functions. I wonder whether
> something similar is available on Linux platforms.
>
> Thank you so much,
> Maura

I love kwrite :-)
it doesn't do anything you don't tell it to do and leaves everything as you 
typed/copied it, unless you set it up different. It also has a very good 
syntax highlighting and other helpers...

Daniel


Re: opensuse - editor that does not eat out TAB characters by G T Smith on 2009-06-15T12:00:08+00:00

Get Eclipse from the Eclipse site (the SuSE build works but you may run
into problems with installing some plugins with it)....

Eclipse should run on anything with a Java JRE/SDK installed...

> Since I will be using SuSE systems to debug such a script, my question is:
> do you know of an editor, running on SuSE, which does not cut off the precious indentation characters making a mess of a python script ?
> For instance, Emacs won't work for this particular problem.
> 
> Some time ago I got an editor running on Windows (on campus I had to use a Windows box) named "UltraEdit" (I am not sure the spelling is right).
> It was a very flexible editor tta could be configured for performing very basic as well as very sophisticated editing functions.
> I wonder whether something similar is available on Linux platforms.
> 
> Thank you so much,
> Maura
> 
> 
> 
>       


- Bjarne Stroustrup
==============================================================================
---

Re: opensuse - editor that does not eat out TAB characters by Per Jessen on 2009-06-15T12:07:03+00:00
Maura Monville wrote:

>=20
> I have just learnt, to my dismay, that python syntax is sensitive to
> indentation, even if python is supposed to be a modern language=20

I thought the fact that python uses indentation to indicate blocks of
code was one of the distinguishing features of Python. =20

> Since I will be using SuSE systems to debug such a script, my questio=
n
> is: do you know of an editor, running on SuSE, which does not cut off=

> the precious indentation characters making a mess of a python script =
?

vi?


/Per     =20


Re: opensuse - editor that does not eat out TAB characters by Anton Aylward on 2009-06-15T12:15:56+00:00
Daniel Bauer said the following on 06/15/2009 07:53 AM:

> 
> I love kwrite :-)
> it doesn't do anything you don't tell it to do and leaves everything as you 
> typed/copied it, unless you set it up different. It also has a very good 
> syntax highlighting and other helpers...

Indeed, and so does VIM and a number of other editors.

How much complexity do you want to deal with?



Re: opensuse - editor that does not eat out TAB characters by Anton Aylward on 2009-06-15T12:16:36+00:00
Maura Monville said the following on 06/15/2009 07:28 AM:

> Since I will be using SuSE systems to debug such a script, my
> question is: do you know of an editor, running on SuSE, which does
> not cut off the precious indentation characters making a mess of a
> python script ? For instance, Emacs won't work for this particular
> problem.

VI - VIM.
There is(are) a switch(es) to control whether tabs get expanded an how
they get 'expanded' on screen - or not.

I'd expect emacs to have one too but I've never been tempted to use
that.   VI/VIM has serve me well for 27 years.


Re: opensuse - editor that does not eat out TAB characters by Dave Howorth on 2009-06-15T12:46:34+00:00
Maura Monville wrote:
> For instance, Emacs won't work for this particular problem.

I don't use emacs or python but ...

'make' files depend on tabs being in exactly the right place and I'd be
astounded if emacs can't be used to edit make files!

It also seems rather strange that there are apparently two Python modes
for emacs if it can't be used to edit python :)

http://www.emacswiki.org/emacs/PythonMode

So my bet is that emacs can be used to edit python. How much do I win?

Cheers, Dave

Re: opensuse - editor that does not eat out TAB characters by Dave Howorth on 2009-06-15T12:48:29+00:00
G T Smith wrote:
> Eclipse should run on anything with a Java JRE/SDK installed...

Surely if eclipse was any good, it would have been written in C and GTK+

;-P

opensuse - Re: editor that does not eat out TAB characters by Heinz Diehl on 2009-06-15T14:20:39+00:00
On 15.06.2009, Maura Monville wrote: 

> For instance, Emacs won't work for this particular problem.

That's not true, you just have to autoload "python-mode" in your .emacs to
get it working.



Re: opensuse - editor that does not eat out TAB characters by Adam Jimerson on 2009-06-15T14:24:36+00:00
On Monday 15 June 2009 08:16:16 am Anton Aylward wrote:
> Daniel Bauer said the following on 06/15/2009 07:53 AM:
> > I love kwrite :-)
> > it doesn't do anything you don't tell it to do and leaves everything as
> > you typed/copied it, unless you set it up different. It also has a very
> > good syntax highlighting and other helpers...
>
> Indeed, and so does VIM and a number of other editors.
>
> How much complexity do you want to deal with?
>
>

Although I'm not a master at VIM I have been using it for years along with=
=20
kwirte for scripting and programming and they both have done their job and=
=20
done it well
=2D-=20
"We must plan for freedom, and not only for security, if for no other reaso=
n=20
than only freedom can make security more secure."  Karl Popper

Re: opensuse - editor that does not eat out TAB characters by Maura Monville on 2009-06-15T15:39:56+00:00

whatever editor I use .. I have not found a way to see the unprintable char=
acters (Tab).=0AMaura=0A=0A=0A=0At also seems rather strange that there are apparently two Python modes=0Afo=
r emacs if it can't be used to edit python :)=0A=0Ahttp://www.emacswiki.org=
/emacs/PythonMode=0A=0ASo my bet is that emacs can be used to edit python. =
How much do I win?=0A=0ACheers, Dave=0A

Re: opensuse - editor that does not eat out TAB characters by Matthias Bach on 2009-06-15T15:48:39+00:00
Hi!

Am Montag 15 Juni 2009 17:39:47 schrieb Maura Monville:
> whatever editor I use .. I have not found a way to see the unprintable
> characters (Tab). Maura

In KWrite configuration: Editing -> First Tab -> Second checkbox.

Regards,
Matthias

Re: opensuse - editor that does not eat out TAB characters by Manfred Hollstein on 2009-06-15T15:54:23+00:00
On Mon, 15 Jun 2009, 17:39:47 +0200, Maura Monville wrote:
> 
> whatever editor I use .. I have not found a way to see the unprintable characters (Tab).
> Maura

hmm, that's pretty easy... Just use "vim" and type :set list<CR>; now
every Tab character will be shown as ^I ;-)

I don't actually like that editing mode, though; if you, however, insist
on changing the leading 8 blanks in a line into a tab, you can run
"unexpand" on any text file to do exactly that ...

Cheers.

l8er
manfred

Re: opensuse - editor that does not eat out TAB characters by Matthias Bach on 2009-06-15T15:58:36+00:00
Hi!

Am Montag 15 Juni 2009 17:54:05 schrieb Manfred Hollstein:
> I don't actually like that editing mode, though; if you, however, insist
> on changing the leading 8 blanks in a line into a tab, you can run
> "unexpand" on any text file to do exactly that ...

You'll love it once you frequently change between systems with 1024 px or 2=
560=20
px wide displays. ;)

Regards,
Matthias

Re: opensuse - editor that does not eat out TAB characters by Anton Aylward on 2009-06-15T16:09:52+00:00
Maura Monville said the following on 06/15/2009 11:39 AM:
> whatever editor I use .. I have not found a way to see the unprintable characters (Tab).

Help us here.
Why do you need to see the tab as a specific marker rather than as
expanded spaces?  If I recall, python only needs the indenting, it
doesn't care what's shown on the screen for you so long as its
consistent, and VI (and I would presume Emacs) will expand tabs on
screen to how ever many display spaces your sweet heart desires.

So what really is your problem here?

Is it that you've grown up in Windows with an editor that shows tabs as
an arrow rather than expanding spaces so you can see the indenting being
aligned?  Or what?  If so, VI can be configured to show tabs as "^I",
but then you don't see the alignment of the indents.  I thought you
wanted to work in Python, so why not use VI's Python mode.  Perhaps I'm
an oddball, but I'd rather see the tabs expanded on screen.

Does Python care whether the indenting is via tabs or spaces so long as
its consistent?

What are you really asking here?
People have offered a number of solutions but you seem to be playing a
"Yes-but" game.




Re: opensuse - editor that does not eat out TAB characters by Manfred Hollstein on 2009-06-15T16:15:30+00:00
On Mon, 15 Jun 2009, 17:58:41 +0200, Matthias Bach wrote:
> Hi!
> 
> Am Montag 15 Juni 2009 17:54:05 schrieb Manfred Hollstein:
> > I don't actually like that editing mode, though; if you, however, insist
> > on changing the leading 8 blanks in a line into a tab, you can run
> > "unexpand" on any text file to do exactly that ...
> 
> You'll love it once you frequently change between systems with 1024 px or 2560 
> px wide displays. ;)

yeah, but then the terminal description is wrong; normally a tab-stop is
every 8 characters. If you look at terminfo(5), the entry for "tab"
shows:

     tab                           ht         ta        tab to next 8-space
   							hardware tab stop

and further down:

   Tabs and Initialization
       If  the  terminal has hardware tabs, the command to advance to the next
       tab stop can be given as ht (usually control I). ...

Dunno if nowadays GUI programs still adhere to such "historical"
standards, though ;-)

> Regards,
> Matthias

Cheers.

l8er
manfred

Re: opensuse - editor that does not eat out TAB characters by nordi on 2009-06-15T17:06:04+00:00
Anton Aylward wrote:
> If I recall, python only needs the indenting, it
> doesn't care what's shown on the screen for you so long as its
> consistent

And this is where the trouble starts if you use tabs: Consistency.
Because as soon as you (or somebody else) use a different editor on a
different machine, chances are that tabs get expanded to the wrong
number of spaces (4 or 8 or whatever). This makes your Python code look
wrong, because many editors (or the authors) will mix tabs and spaces.

So there are two rules from PEP 8 [1] that you should -really- obey:

- Never mix tabs and spaces.
- For new projects, spaces-only are strongly recommended over tabs.

Everything else is just a major PITA! Also, always start python with the
"-tt" option, this will raise an error if tabs and spaces are mixed in a
way that is ambiguous.

Regards
nordi


[1]
http://www.python.org/dev/peps/pep-0008/


Re: opensuse - editor that does not eat out TAB characters by Maura Monville on 2009-06-15T21:01:26+00:00

Personally I do hate Windows. Although, in certain environments the develop=
ment platform, and even the tools, are imposed ... take irt or leave it. =
=0A=0AMy current problem stems from my ignorance about python. On top of th=
at I have to use the undocumented python code written by an Ms. student who=
 decided to leave the Computer Science program when he was just a couple of=
 weeks from defending his thesis. A crazy behaviour that nobody expected. =
=0ABy trial and error I succeeded in getting the python script run to compl=
etion without any error. But the oputut it generates is not what was expect=
ed. Basically the python script is supposed to extract automatically some d=
ata from the miRecords data base which is public and available in form of s=
tructurated HTML web pages.=0AI understand where the python script gets the=
 raw data (miRecords). But I cannot understand where it stores the informat=
ion it is supposed to extract. It looks like the script is trying to store =
the info into a local database that might be =0AMySql or SQLight.  Since I =
cannot see any call or link to either databases, I tried to run the python =
script step-by-step. =0ASince python is a scripting language I would expect=
 to be able to accomplish that just copying llines from the script and past=
ing them onto a python terminal shell. But, regardless of which editor I us=
e, python interpreter prints out plenty of "indentation error " messages. =
=0AI tried an interactive graphic debug session by typing #ddd pbd  ... whi=
ch brought up a nice GUI expecting an executable to be uploaded (sigh !). =
=0AI did not install pydbg as no rpm file is provided (as far as I know) an=
d its installation procedure from source code is not clear to me.  I do not=
 know whether the standard steps (configure, make, make install) can be app=
lyed to a scripting language.=0AI am appalled at a modern object-oriented l=
anguage that is built on a suyntax which is sensistive to indentation !=0A=
=0AI hope I won't irritate anyone if I post some excerpts of my pdb debuggi=
ng attempts ... maybe they will be meaningful for =0Apythons experienced us=
ers.=0A=0A=0AThank you very much for your patience.=0AMaura=0A=0A=0A=0Arker rather than as=0Aexpanded spaces?  If I recall, python only needs the =
indenting, it=0Adoesn't care what's shown on the screen for you so long as =
its=0Aconsistent, and VI (and I would presume Emacs) will expand tabs on=0A=
screen to how ever many display spaces your sweet heart desires.=0A=0ASo wh=
at really is your problem here?=0A=0AIs it that you've grown up in Windows =
with an editor that shows tabs as=0Aan arrow rather than expanding spaces s=
o you can see the indenting being=0Aaligned?  Or what?  If so, VI can be co=
nfigured to show tabs as "^I",=0Abut then you don't see the alignment of th=
e indents.  I thought you=0Awanted to work in Python, so why not use VI's P=
ython mode.  Perhaps I'm=0Aan oddball, but I'd rather see the tabs expanded=
 on screen.=0A=0ADoes Python care whether the indenting is via tabs or spac=
es so long as=0Aits consistent?=0A=0AWhat are you really asking here?=0APeo=
ple have offered a number of solutions but you seem to be playing a=0A"Yes-=
but" game.=0A=0A=0A=0A

Re: opensuse - editor that does not eat out TAB characters by Boyd Stephen Smith Jr. on 2009-06-15T21:22:22+00:00
In <854438.63892.qm@web24208.mail.ird.yahoo.com>, Maura Monville wrote:
>Personally I do hate Windows. Although, in certain environments the
> development platform, and even the tools, are imposed ... take irt or
> leave it.

I always tell them I'll leave it.  There is fallout, but there's fallout th=
e=20
other way too.

> Since python is
> a scripting language I would expect to be able to accomplish that just
> copying llines from the script and pasting them onto a python terminal
> shell. But, regardless of which editor I use, python interpreter prints
> out plenty of "indentation error " messages.

Your editor, editor toolkit, clipboard, or terminal toolkit may be munging=
=20
this[1].  It's often not easy to copy/paste tabs.  You might try using a=20
python debugger, if such a thing exists, and have it read the file, but=20
step/next/continue between lines based on your input.
=2D-=20
Boyd Stephen Smith Jr.           	 ,=3D ,taking that output and pasting it anywhere else results in the tabs being=20
turned into spaces.

Re: opensuse - editor that does not eat out TAB characters by Bob Rea on 2009-06-15T21:47:32+00:00
On Mon June 15 2009 5:01 pm, Maura Monville wrote:
> I hope I won't irritate anyone if I post some excerpts of
> my pdb debugging attempts ... maybe they will be
> meaningful for pythons experienced users.

Maura, there is a very helpful python mailing list that 
deals with exactly your situation. Go to python.com and 
find it. It will be a big help.
Where is Bill Stringfellow
	now that we really need him?

Re: opensuse - editor that does not eat out TAB characters by nordi on 2009-06-16T00:05:12+00:00
Maura Monville wrote:
> I tried to run the python script step-by-step. 
Have you tried pdb for that? A very nice introduction can be found at
[1], plus some links. That is probably better than copy and paste
anyway, because you would always have to copy and paste all "import"
statements before code snippets can work.


> I am appalled at a modern object-oriented language that is built on a suyntax which is sensistive to indentation !
This is not a bug, it is a feature. It forces programmers to use
indentation, and to use it consistently. That means all Python programs
are indented the same way (=easy to read).

Also, you don't have to explicitly mark blocks with {..} or do...done or
whatever as in other languages. This explicit marking and the
indentation have redundant info about the program structure: One is for
the compiler/interpreter, one for the human. But redundancy can lead to
inconsistency, e.g. a programmer writing
if (foo == 1)
    bar();
    foobar();
For the human eye, foobar() belongs to the if statement. For the
compiler it does not, because there is no {...}. This kind of mistake
cannot happen in Python, because syntactically, what you see is what you
get. Removing the redundant info also makes it easier to read the code,
because there is simply less to read.

So using indentation as part of the syntax makes programs easier to read
 and eliminates an entire class of programming errors.


Regards
nordi


[1] http://www.ferg.org/papers/debugging-in-python.html



Re: opensuse - editor that does not eat out TAB characters by Anthony Simonelli on 2009-06-16T05:59:59+00:00
On Monday 15 June 2009 04:01:16 pm Maura Monville wrote:
> 
> Personally I do hate Windows. Although, in certain environments the development platform, and even the tools, are imposed ... take irt or leave it. 
> 
> My current problem stems from my ignorance about python. On top of that I have to use the undocumented python code written by an Ms. student who decided to leave the Computer Science program when he was just a couple of weeks from defending his thesis. A crazy behaviour that nobody expected. 
> By trial and error I succeeded in getting the python script run to completion without any error. But the oputut it generates is not what was expected. Basically the python script is supposed to extract automatically some data from the miRecords data base which is public and available in form of structurated HTML web pages.
> I understand where the python script gets the raw data (miRecords). But I cannot understand where it stores the information it is supposed to extract. It looks like the script is trying to store the info into a local database that might be 
> MySql or SQLight.  Since I cannot see any call or link to either databases, I tried to run the python script step-by-step. 
> Since python is a scripting language I would expect to be able to accomplish that just copying llines from the script and pasting them onto a python terminal shell. But, regardless of which editor I use, python interpreter prints out plenty of "indentation error " messages. 
> I tried an interactive graphic debug session by typing #ddd pbd  ... which brought up a nice GUI expecting an executable to be uploaded (sigh !). 
> I did not install pydbg as no rpm file is provided (as far as I know) and its installation procedure from source code is not clear to me.  I do not know whether the standard steps (configure, make, make install) can be applyed to a scripting language.
> I am appalled at a modern object-oriented language that is built on a suyntax which is sensistive to indentation !
> 
> I hope I won't irritate anyone if I post some excerpts of my pdb debugging attempts ... maybe they will be meaningful for 
> pythons experienced users.

I suggest using IDLE (zypper install python-idle).  This program was written in Python using the Tkinter GUI toolkit.  It provides an interpreter interface as well as an editor.  The editor allows you to write Python scripts easily with auto-indentation and syntax highlighting.  It uses a lot of conventions that a lot of Python programmers use when writing their code.  It even has help on the syntax of functions at the interpreter.  Worth a try.
Anthony

Re: opensuse - editor that does not eat out TAB characters by Maura Monville on 2009-06-16T08:49:45+00:00

I did installed python-idle from Yast which requested SuSE 11.1 DVD  ... I =
hope it is the same as the one that zypper would have installed.=0A=0AAnywa=
y, no new applet or icon has been added to the Application menu. =0AI tried=
 to launch it from terminal command line but I do not know where Yast place=
d it.=0A=0Amauede@linux-326k:~> which python-idle=0Awhich: no python-idle i=
n (/home/bin/Spectra:/home/mauede/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin=
/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib64/jvm/jre/bin:/usr/li=
b/mit/bin:/usr/lib/mit/sbin)=0A=0Amauede@linux-326k:~> which idle=0A/usr/bi=
n/idle=0A=0ASo I launched as above:=0Amauede@linux-326k:~> /usr/bin/idle=0A=
IDLE Subprocess: socket error: Connection refused, retrying....=0A=0AIt ope=
ned up a window. I assume I have to use such a window to debug the python s=
cript.=0AI have always used debugger with compiled code ... so I feel at a =
loss.=0AI need to run the python script passing a parameter and do not know=
 how to do.=0AIs there an IDLE demo ?=0A=0AThank you very much,=0AMaura=0A=
=0A=0A=0A=0A=0A=0A. On top of that I have to use the undocumented python code written by an M=
s. student who decided to leave the Computer Science program when he was ju=
st a couple of weeks from defending his thesis. A crazy behaviour that nobo=
dy expected. =0A> By trial and error I succeeded in getting the python scri=
pt run to completion without any error. But the oputut it generates is not =
what was expected. Basically the python script is supposed to extract autom=
atically some data from the miRecords data base which is public and availab=
le in form of structurated HTML web pages.=0A> I understand where the pytho=
n script gets the raw data (miRecords). But I cannot understand where it st=
ores the information it is supposed to extract. It looks like the script is=
 trying to store the info into a local database that might be =0A> MySql or=
 SQLight.  Since I cannot see any call or link to either databases, I tried=
 to run the python script step-by-step. =0A> Since python is a scripting la=
nguage I would expect to be able to accomplish that just copying llines fro=
m the script and pasting them onto a python terminal shell. But, regardless=
 of which editor I use, python interpreter prints out plenty of "indentatio=
n error " messages. =0A> I tried an interactive graphic debug session by ty=
ping #ddd pbd  ... which brought up a nice GUI expecting an executable to b=
e uploaded (sigh !). =0A> I did not install pydbg as no rpm file is provide=
d (as far as I know) and its installation procedure from source code is not=
 clear to me.  I do not know whether the standard steps (configure, make, m=
ake install) can be applyed to a scripting language.=0A> I am appalled at a=
 modern object-oriented language that is built on a suyntax which is sensis=
tive to indentation !=0A> =0A> I hope I won't irritate anyone if I post som=
e excerpts of my pdb debugging attempts ... maybe they will be meaningful f=
or =0A> pythons experienced users.=0A=0AI suggest using IDLE (zypper instal=
l python-idle).  This program was written in Python using the Tkinter GUI t=
oolkit.  It provides an interpreter interface as well as an editor.  The ed=
itor allows you to write Python scripts easily with auto-indentation and sy=
ntax highlighting.  It uses a lot of conventions that a lot of Python progr=
ammers use when writing their code.  It even has help on the syntax of func=
tions at the interpreter.  Worth a try.=0A

Re: opensuse - editor that does not eat out TAB characters by G T Smith on 2009-06-16T10:05:12+00:00
> are indented the same way (=easy to read).
> 

Indentation based block definition has some limitations. While many
aspects of Python are very good, this particular departure is problematic.

I explored Python out of curiosity a while back and this particular
feature was enough for me not to consider making use of the language for
any future project.


> Also, you don't have to explicitly mark blocks with {..} or do...done or
> whatever as in other languages. This explicit marking and the
> indentation have redundant info about the program structure: One is for
> the compiler/interpreter, one for the human. But redundancy can lead to
> inconsistency, e.g. a programmer writing
> if (foo == 1)
>     bar();
>     foobar();

A minor issue. Which for any half way decent IDE would be reformatted as ..

either

if (foo == 1 ) bar();
foobar();

or

if (foo == 1 )
   bar();
foobar();

according to formatting preferences by applying the IDE formatter...

BTW Some consider it good practice in C/C++ and similar to use the form...

if (1 == foo) bar();

to avoid accidents like

if (foo = 1) bar();

which is usually correct syntax but may not give intended result. When...

if (1 = foo) bar()

in most languages will generate a runtime or compile syntax error..


> For the human eye, foobar() belongs to the if statement. For the
> compiler it does not, because there is no {...}. This kind of mistake
> cannot happen in Python, because syntactically, what you see is what you
> get. Removing the redundant info also makes it easier to read the code,
> because there is simply less to read.

Depends whether the syntax actually adds functionally, e.g. in many
C/C++ like languages blocks can be used to control variable scope.
(Something rather difficult to follow without an explicit beginning and
end of block definition). What the block indentation does is make EOL a
kind of implicit end of statement and obscures more subtle aspects of
code structure.

(Closures must be fun in Python... :-) )



> 
> So using indentation as part of the syntax makes programs easier to read
>  and eliminates an entire class of programming errors.
> 
> 
> Regards
> nordi
> 
> 
> [1] http://www.ferg.org/papers/debugging-in-python.html
> 
> 


- Bjarne Stroustrup
==============================================================================
---

Re: opensuse - editor that does not eat out TAB characters by G T Smith on 2009-06-16T10:05:47+00:00

Actually Eclipses limitations on Linux (such as they are) are due to it
being written with the GTK variant on of the Java SDK. It started of
life as alternative to SUNS Java IDE, but has kind of wandered of to
some other places. As for some functionality it obviously uses Java
introspection functionality it pretty much has to be written in Java.

Eclipse has a bewildering array of free (and not free) plugins. I
currently have the C/C++ and Perl extensions loading plus some odds and
sods for other thinks like Subversion and CVS. Its main problem is that
if anything it has too many extensions.

It is is the effectively the Open Source alternative to M$ Visual Studio
with significant technical input from IBM.

- Bjarne Stroustrup
==============================================================================
---

Re: opensuse - editor that does not eat out TAB characters by nordi on 2009-06-16T16:19:04+00:00
G T Smith wrote:
> Indentation based block definition has some limitations.
I would like to know about those limitations. You can use blocks for
scoping variables even when those blocks are 'only' defined with
indentation. Python does not do that, but that does not mean it cannot
be done. Anything else?

> A minor issue. Which for any half way decent IDE would be reformatted as ..
You are assuming that you have an IDE ready when you do the development.
 This only holds true until you have to work on a customers server over
ssh to fix a bug. And it assumes you always write your programs with an
IDE. I, at least, do not edit my shell scripts with Eclipse. Neither
would I write Python or Perl programs of just 50 lines with a big IDE.

> BTW Some consider it good practice in C/C++ and similar to use the form...
> 
> if (1 == foo) bar();
> 
> to avoid accidents like
> 
> if (foo = 1) bar();
Yes, that is certainly good practice. But the second example will get
you a syntax error in Python, another kind of mistake you cannot make in
that language. Probably a lesson learned from C.


A note to the TO: When you try to get the program to work, make sure you
use the same version of Python that was used to program it. Some other
distributions ship rather old Python versions (their package management
uses Python, so they are much more conservative with new Python
versions). If your program was written for one of the old versions it
may give you trouble with Python version 2.6 that ships with current
openSuse distributions.

Regards
nordi


Re: opensuse - editor that does not eat out TAB characters by G T Smith on 2009-06-18T11:14:39+00:00
> 

Mildly puzzled by this assertion, Python does not support this but it
can be done!? (how? by a code hack or redefining the language syntax).

My view on the block delimitators is they are rather like the capital
letter at the beginning of a sentence and a full stop at the end. They
are not essential but they help make things more readable.

>> A minor issue. Which for any half way decent IDE would be reformatted as ..
> You are assuming that you have an IDE ready when you do the development.
>  This only holds true until you have to work on a customers server over
> ssh to fix a bug. And it assumes you always write your programs with an
> IDE. I, at least, do not edit my shell scripts with Eclipse. Neither
> would I write Python or Perl programs of just 50 lines with a big IDE.
> 

For small scripts I would agree using full IDE is a bit like cracking a
nut with sledgehammer, but for more complex applications a full IDE,
with non runtime syntax checking, formatting, IDE controlled debugging
and CVS /Subversion support is pretty well essential. (BTW I have run
Eclipse over ssh and it usually works quite well). Also in situations
where you have to work with a language you are unfamiliar with or very
rusty on, IDE syntax checking and help systems can be very helpful.

BTW I would not never consider debugging code on a production machine if
I could possibly avoid it. That path leads to madness....


>> BTW Some consider it good practice in C/C++ and similar to use the form...
>>
>> if (1 == foo) bar();
>>
>> to avoid accidents like
>>
>> if (foo = 1) bar();
> Yes, that is certainly good practice. But the second example will get
> you a syntax error in Python, another kind of mistake you cannot make in
> that language. Probably a lesson learned from C.
> 

There are occasions that assignment within a logical test is quite
useful for brevity or complex coding. So this is not always an error but
this is more an indicator that this is an intended rather than an
unintended action. For those unfamiliar with the language it can be
difficult to follow, however one tends to assume that those charged with
maintenance have some knowledge.


> 
> A note to the TO: When you try to get the program to work, make sure you
> use the same version of Python that was used to program it. Some other
> distributions ship rather old Python versions (their package management
> uses Python, so they are much more conservative with new Python
> versions). If your program was written for one of the old versions it
> may give you trouble with Python version 2.6 that ships with current
> openSuse distributions.
> 

Hmmm... Another reason to avoid python IMHO, most versions of a language
should have a degree of backwards compatibility.

> Regards
> nordi
> 


- Bjarne Stroustrup
==============================================================================
---
Loading


$ This page is proudly powered by www.pubbs.net, you can see more at opensuse archive | Partners: Global Manufacturers