Differences between revisions 12 and 13
Revision 12 as of 2015-06-11 21:43:55
Size: 4567
Editor: ErikJohnson
Comment:
Revision 13 as of 2015-06-11 21:50:22
Size: 4708
Editor: ErikJohnson
Comment:
Deletions are marked like this. Additions are marked like this.
Line 51: Line 51:
format, all the indentation get stripped! That's such a pain in the -bleep-! No other modern languages
have this problem!" I just laughed and told him, "I've used Python for over 10 years, and have yet to
see this problem. It's not a convincing argument that something is wrong with Python. Python wasn't
designed for that (nor did it ever advertise that you could)."
format, all the indentation gets stripped! That's such a pain in the -bleep-! No other modern languages
have this problem - they all use curly braces to make blocks explicit!" Yes, well... some people will
"get" this design decision, others may not.
I just laughed and told him, "I've used Python for over
10 years, and have '''''yet''''' to see this problem. It's not a convincing argument that something is
wrong with Python. Python wasn't designed for that (nor did it ever advertise that you could)."
Line 58: Line 59:
surprised if there isn't some similar way to get text to come out without the whitespace stripped in PDF.) surprised if there isn't some similar feature to get text to come out without the whitespace stripped in PDF.)
If you've lost all your source formatting, that's a problem even if it may still compile.
Line 60: Line 62:
If you've lost all your source formatting, it's a problem, even if it might still compile. Anyway, don't do that.
Anyway, don't do that.

Erik Johnson

I am a member of the Albuquerque Python Meetup: http://wiki.python.org/AbqPython/ http://www.meetup.com/AbqPython/

My email: Spam is largely out of control on the internet. Sometimes I check email at HedgesFan at G mail dot com. If you want my regular email address that is checked almost daily, ask me for it.

Python Ramblings

I am currently doing a course on Coursera titled An introduction to Interactive Programming In Python. (The link is to the actual instance of the class I am in - you may need to go in through the Coursera front page and search class listings to get to the next offering of the class.)

I don't really expect to learn a lot about the Python language itself, but some neat things are starting to happen with programming languages in general. In this case, they are using a wholly in-browser environment to run Python. It's not quite the same Python, but almost (one shortcoming I noticed is iteritems() on dict is missing.) This is based on http://www.skulpt.org/

Programming Contest Sites

Vim stuff

Significant whitespace (i.e., indentation) is one of the biggest complaints I hear about Python. I have to admit I was not a big of it at first, and had some issues with spaces and tabs getting mixed up and causing my program ot not run correctly. I have since come to see Python's significant white space as one of its best features. Python executes just like it looks, and looks just like it executes! They've been defined to be the same thing! Code reads just like it looks, because you can't be lazy and not indent your code properly - its required to achieve the correct behavior. IMHO: it is not a design flaw: it was a wise design decision.

I did have a colleague come to me once (I guess as some sort of perceived representative for Python) and bitterly complain: "I remember now why I don't like Python! When you store your source code in PDF format, all the indentation gets stripped! That's such a pain in the -bleep-! No other modern languages have this problem - they all use curly braces to make blocks explicit!" Yes, well... some people will "get" this design decision, others may not. I just laughed and told him, "I've used Python for over 10 years, and have yet to see this problem. It's not a convincing argument that something is wrong with Python. Python wasn't designed for that (nor did it ever advertise that you could)."

It is a fairly compelling argument not to store your Python source in PDF format, though. (If you want to display Python source in HTML, wrap it in a <pre> tag. I'm no PDF expert, but I would be surprised if there isn't some similar feature to get text to come out without the whitespace stripped in PDF.) If you've lost all your source formatting, that's a problem even if it may still compile.

Anyway, don't do that.

Using this .vimrc (or _vimrc on Windows), I've hardly thought about this indentation issue for over a decade:

set tabstop:4
set shiftwidth:4
set et
set autoindent
set wrap
set textwidth=72
syn on

Some other vim tricks/settings I don't want to lose track of:


CategoryHomepage

ErikJohnson (last edited 2018-05-24 19:40:20 by ErikJohnson)

Unable to edit the page? See the FrontPage for instructions.