Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^4: No Hard Tabs in Code

by MonkOfAnotherSect (Sexton)
on Jul 08, 2010 at 08:03 UTC ( #848641=note: print w/replies, xml ) Need Help??

in reply to Re^3: No Hard Tabs in Code
in thread No Hard Tabs in Code

Or, to use a heretical example, Python forces you to use only indentation, and forbids alignment.

Python forces you to indent consistently but does not mandate what consistency is required (it's possible to mix tabs and spaces, but that's unfortunate).

Python does not mandate alignment (though there is common practice - see PEP8), and if you wanted to format a Python dict like a (standard) Perl hash with keys, colons, and values each aligned, you could. You could also put the closing brace wherever you wanted: end of line, start of next line, indented, matching the opening brace... Same goes for method parameters - the "def" has to be at the correct indentation, but everything after that is freely alignable. If you wanted to align open parentheses of every method, align parameters one below another, and close the parentheses 4 spaces in, you can. etc etc etc.

It is possible to write any program in perfectly legal, if unpleasant, python where only a single character has forced indentation, and everything else can be freely aligned. (It's also possible to write any program with a total of 2 keywords and no other letters, numbers, or hardcoded strings, but that's considered impolite)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://848641]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2021-10-20 20:07 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (82 votes). Check out past polls.