Live data from Hacker News

Another reason you should learn to code: Python for Excel

gigaom.com

21–30 of 32 posts

Re: Another reason you should learn to code: Python for Excel

#21
I find it interesting that the piece doesn't cite Hacker News as how the author discovered Iron Python. There is only this: "I’m glad I stumbled on to this project." For whatever reason, authors are generally good about citing other blogs as sources – even just for links, not commentary – but aggregators like HN are almost never acknowledged.

Re: Another reason you should learn to code: Python for Excel

#22

I find it interesting that the piece doesn't cite Hacker News as how the author discovered Iron Python. There is only this: "I’m glad I stumbled on to this project." For whatever reason, authors are generally good about citing other blogs as sources – even just for links, not commentary – but aggregators like HN are almost never acknowledged.

Agreed. I imagine bloggers like John Gruber find a good bit of material on HN, and never reference it, even though he's adamant on citing other bloggers. Strange.

Re: Another reason you should learn to code: Python for Excel

#23
post #14

I can see what the author is trying to get at, but I can't help but think the example is not so good. If you use Excel and want to take it a bit further I would suggest that RExcel is probably a better choice. The R environment has abundant, relevant functionality for those who use Excel frequently. When I encountered tasks that were tedious in Excel or beyond the abilities of Excel I went searching for a solution. A…

"I can see using R as a gateway to other programming languages."

So true. A fairly common path is Excel to VBA to RExcel to R to C++. R is great for exploring and prototyping but then C++ is often used to hard-wire the final R code for speed.

Re: Another reason you should learn to code: Python for Excel

#24
post #18
post #15

VBA is one of the best languages and environments for beginners ever. Why using Python instead would give the beginner anything, is beyond me. Here's a shortlist: - VBA is case-insensitive. If you don't know the significance of this, you've never taught beginners - VBA hides event binding and namespaces for the user. Major obstacles removed - VBA has full autocomplete - VBA has F1 context-sensitive help - VBA automat…

With the same argument you would easily arrive to the conclusion that the best way to learn grammar is a spell checker. Actually it depends, if those beginners are supposed to become programmers then you're wrong, if they just want to write one piece of software once in their life and never do it again then maybe you're right.

An important part of teaching a beginner is making sure they don't get bored or frustrated. Their first language may not give them all the experience they'll need down the road, and may not be something they'll ever use again, but what you need is something that's not frustrating and gives them the idea that they themselves can actually make something. Spark the interest, and they'll want to press on.

Re: Another reason you should learn to code: Python for Excel

#25
This is probably a net good: new ways for people to apply their Python knowledge are good, and new means and incentives for people to get into coding or make life easier are good, and Python is looking more future-proof than VBA at this point.

But the main selling point for this on the linked page and video is that the resulting code is shorter, and the code is only really shorter because the VBA code declares its variables. The video narrator even says that writing VBA is slower because you have to declare variables before use. I'm sure HN has had plenty of debates about declaring variables in the past, but personally I don't feel it slows me down much more than just thinking of a variable. Anyway, by default you don't have to declare variables in VBA, though it is good practice, especially for larger projects.

Also, that 40-line+ heap of VBA they show being changed into 14 lines of Python is rather unfair. They've written a function for finding the minimum in a range and then loop through a range when they could use worksheet functions (also accessible via VBA) for both. I make it around 12 lines of VBA if you do it that way. Or you could just use 3 worksheet functions and no macros at all.

OK, so these hypothetical beginners may not know the best way to do things in VBA - but they probably aren't going to use lambdas in Python as in the example, either. (Though I do like the possibilities of lambdas for various Excel tasks I've done in the past!)

Re: Another reason you should learn to code: Python for Excel

#26

Been available in perl for years.

Yeah, I was doing that well over a decade ago.

At that time, I found it most convenient to use Perl for some things, e.g. condensing a "ton" of raw data down into an Excel representation, and VBA for others (manipulating extant worksheets/workbooks).

I also wrote a object-oriented API wrapper in VBA. VBA's fine for doing real work, when you're in the MS Office environment -- or when you have a "plain Jane" Windows machine with no ability/authority to add another toolset.

Re: Another reason you should learn to code: Python for Excel

#27
post #10

Been available in perl for years.

You got any links?

At a glance

https://www.google.com/#q=perl+excel

seems to surface both a bunch of links from the beginning of the last decade, and some current stuff. I would be more familiar with the former, so it may be best to form your own opinion on the current state of things. But I'm commenting here, to the effect that there is much information readily available.

P.S. At least of a decade ago, it helped to have a good understanding of Excel and its programmatic interface. One or more Perl modules made it easy to call into this interface, but you still needed to know what was available and what it would do.

Re: Another reason you should learn to code: Python for Excel

#28

Two articles on HN, yet still no answer to "How is this better than using Python and Excel with COM?" I'm almost disappointed that so many people think this is an impressive new thing.

It might not be very impressive technically but that is not the major selling point (to me). I like it because Ironspread allows me to use Python in Excel without having to learn COM. This is great because interacting with Excel would be the only reason to learn COM for me (and my co-workers).

Re: Another reason you should learn to code: Python for Excel

#30
post #18

Earlier quoted context omitted.

With the same argument you would easily arrive to the conclusion that the best way to learn grammar is a spell checker. Actually it depends, if those beginners are supposed to become programmers then you're wrong, if they just want to write one piece of software once in their life and never do it again then maybe you're right.

An important part of teaching a beginner is making sure they don't get bored or frustrated. Their first language may not give them all the experience they'll need down the road, and may not be something they'll ever use again, but what you need is something that's not frustrating and gives them the idea that they themselves can actually make something. Spark the interest, and they'll want to press on.

Yup. Scheme and Scratch fit that description well.

1. http://www.trollope.org/scheme.html

2. http://racket-lang.org/learning.html

3. http://scratch.mit.edu/

Post reply on HN