Be careful if you use tab mixed with spaces and prefer 4-space indentation.
Python interprets tabs as 8-space indent. See python document below:
http://docs.python.org/reference/lexical_analysis.html#indentation
HTH
-Original Message-
From: Schubert, Carsten [PRDUS] [mailto:cschu...@its.jnj.com]
Sent: Wednesday, January 27, 2010 1:31 AM
To: Jason Vertrees; David Hall
Cc: pymol-users
Subject: Re: [PyMOL] Whitespacing?
Not much of a help, but WingIDE Professional Edition has a very good
indentation manager, which takes care of the mixed/space tab issues. If you are
working in python frequently it is a worthwhile investment.
Cheers,
Carsten
> -Original Message-
> From: Jason Vertrees [mailto:jason.vertr...@schrodinger.com]
> Sent: Tuesday, January 26, 2010 10:10 AM
> To: David Hall
> Cc: pymol-users
> Subject: Re: [PyMOL] Whitespacing?
>
> David,
>
> Oh, the joys of open-source. Here's my solution for you:
> (1) load your file in your favorite editor
> (2) determine user-desired tab stop setting
> (3) convert all tabs to spaces in your editor (or search replace tabs
> with X-spaces)
> (4) save your file
>
> One warning though, I have seen some interpreters crash when they
> encounter spaces over tabs.
>
> -- Jason
>
> On Tue, Jan 26, 2010 at 9:12 AM, David Hall
> wrote:
> > During my editing of dynoplot.py, I noticed that there were some
> > whitespace issues. Normally I consider whitespace a bikeshedding
> > topic, but in python, it is significant, so it matters. When tabs
> and
> > spaces are mixed, our own personal settings for how tabs are
> displayed
> > in an editor makes a huge difference in whether the script is
> > understandable.
> >
> > I checked out the git repo of pymol scripts (
> > http://github.com/jlec/Pymol-script-repo/ ) and did some analysis
> >
> > First, these files switch between some lines where all indenting is
> > tabs to lines where all indenting is spaces:
> > Objects_and_Selections/color_objects.py has 8 tab lines and 34 space
> lines
> > ThirdParty_Scripts/WFMesh.py has 52 tab lines and 21 space lines
> > biochemical_scripts/pucker.py has 167 tab lines and 5 space lines
> > math_geo_cgo/modevectors.py has 160 tab lines and 2 space lines
> > structural_biology_scripts/DynoPlot.py has 82 tab lines and 27 space
> lines
> > structural_biology_scripts/Rotamers.py has 86 tab lines and 22 space
> lines
> > structural_biology_scripts/kabsch.py has 51 tab lines and 4 space
> lines
> >
> > Second, there are files where the indenting inside a line switches
> > back and forth (numbers are the counts of lines that have both tabs
> > and spaces in indenting):
> > Objects_and_Selections/color_objects.py: 19
> > ThirdParty_Scripts/WFMesh.py: 29
> > ThirdParty_Scripts/transform_odb.py: 6
> > math_geo_cgo/modevectors.py: 12
> > structural_biology_scripts/DynoPlot.py: 83
> > structural_biology_scripts/Rotamers.py: 86
> > structural_biology_scripts/kabsch.py: 1
> >
> > I've tried using pindent.py (
> > http://svn.python.org/projects/python/trunk/Tools/scripts/pindent.py
> )
> > and PythonTidy ( http://pypi.python.org/pypi/PythonTidy/ ) to
> > generally fix these, but they both run into problems. Is there a
> > general solution out in the python world to automatically fix this?
> I
> > don't care whether it produces tabs or spaces. I just want one or
> the
> > other. If someone points me to something, I'm more than willing to
> > run it on these scripts, push them back to github and copy them back
> > onto the wiki.
> >
> > -David
> >
> > -
> -
> > The Planet: dedicated and managed hosting, cloud storage, colocation
> > Stay online with enterprise data centers and the best network in the
> business
> > Choose flexible plans and management services without long-term
> contracts
> > Personal 24x7 support from experience hosting pros just a phone call
> away.
> > http://p.sf.net/sfu/theplanet-com
> > ___
> > PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> > Archives: http://www.mail-archive.com/pymol-
> us...@lists.sourceforge.net
> >
>
>
>
> --
> Jason Vertrees, PhD
> PyMOL Product Manager
> Schrodinger, LLC
>
> (e) jason.vertr...@schrodinger.com
> (o) +1 (603) 374-7120
>
> ---
> ---
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the
> business
> Choose flexible plans and management services without long-term
> contracts
> Personal 24x7 support from experience hosting pros just a phone call
> away.
> http://p.sf.net/sfu/theplanet-com
> ___
> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge