On Sun, Jul 17, 2011 at 1:29 AM, Andrew Berg <[email protected]> wrote:
> You're right. TabError is only raised if the initial indentation is
> inconsistent.
> Not legal:
> def spam():
> <tab>print('Wonderful spam!\n')
> <4 spaces>print('Bloody Vikings!')
>
> Legal:
> def eggs():
> <tab>print(
> <tab><tab>'Blech!\n',<some spaces to align>'Whaddya mean, "blech"?\n',
> <tab><tab>'I don\'t like spam!\n',<spaces to align>'...'
> <tab><tab>)
Even this is legal:
def eggs()
<tab>if spam:
<tab><spaces>print("Spam and eggs")
<tab>else:
<tab><tab>print("Just eggs")
It's only when you're inconsistent about the added indent of a single
block that Python will complain.
--
http://mail.python.org/mailman/listinfo/python-list