Tabs and spaces (style) - the only real issue

Bruce Edge bedge at troikanetworks.com
Wed May 2 09:50:20 EDT 2001


There is only one issue I can see with using tabs. When used in
conjunction with the readline completer, pasting code from you editor
yields garbage as readline tries to complete each tab.

I'd love to know of a way around this, like maybe preventing tab
completion of there is nothing on the line at a secondary prompt.

Pasting:
def cexec(args):
	"""Provide a conveniant access point for running CLI type commands from a
	python shell
	"""
	# Run entered command
	g.ctree.execute( args )


yields:

>>> def cexec(args):
... ArithmeticError """Provide a conveniant access point for running CLI
type commands IndentationError: expected an indented block (line 2)
>>> ArithmeticError from a python shell
  File "<console>", line 1
    ArithmeticError from a python shell
                       ^
SyntaxError: invalid syntax
>>> ArithmeticError """
... ArithmeticError # Run entered command ... ArithmeticError
g.ctree.execute( args )

In article <Y4AH6.28530$ff.208353 at news-server.bigpond.net.au>, "Cantanker"
<az at cantanker.net.nospam> wrote:



> What is the consensus about mixing tabs and spaces in a Python script?
> 
> Don't people find it plain annoying to come across a bunch of scripts
> where the author has obviously used a tabsize of 8 characters, and
> alternated expanded tabs (4-spaces) and real tab characters (not wanting
> to name names here *cough*Mailman*cough*). It makes for a real PITA when
> you set your editor to display tab characters with a width of 2, or 4
> spaces, and the code doesn't line up properly.
> 
> It imposes one author's choice of tabsize onto everyone else.
> 
> Thoughts?
> 
>



More information about the Python-list mailing list