Python and Ruby Scripting Resources and the Sharp Glyph

Do you know very little about scripting and want to get started?

Here are some recommendations on getting started with Python and Ruby from Steven Mycynek of the Revit API development team and Saikat Bhattacharya of Autodesk Consulting.

I am writing this from the most wonderful organic restaurant ever, life alive in Cambridge, Massachusetts, on my way to the Boston airport to fly back home.

life alive

Steven's Recommendations

Ruby and Python are the two main scripting languages Revit is working with. If you want to learn them and don't have any experience, I highly recommend you start here:

These websites give you an interactive Python and Ruby shell right from your web browser; Windows with Internet Explorer, Chrome, or FireFox work best. There is nothing to install, and there is a built-in tutorial on each site.

Spend a couple hours with each of these websites and decide which language you want to pursue.

Here are some up-front things to consider:

Python

Ruby

I think it is impossible to say that one is easier than the other, but you might find more Python developers in your everyday life to help with beginner questions.

Once you have decided what you want to do next, here are a few good beginners books:

If you would like to install Python or Ruby instead of using the interactive websites, here are the sources for that:

With regards to IronRuby, I would suggest focusing on the basics of Ruby first and not to worry about integrating with .NET right away. Start with these.

Python the Hard Way

Saikat Bhattacharya, who meanwhile has moved on from the ADN AEC workgroup to Autodesk Consulting, stumbled over another great free Python learning book that I find amusing and takes you a step deeper into real programming issues, learnpythonthehardway.org/book.

It has a bit of a stricter tone. Don't let it bother you, as the author is just trying to do what is best for the beginner.

I really like this section:

A Warning For The Smarties

Sometimes people who already know a programming language will read this book and feel I'm insulting them. There is nothing in this book that is intended to be interpreted as condescending, insulting, or belittling. I simply know more about programming than my intended readers. If you think you are smarter than me then you will feel talked down to and there's nothing I can do about that because you are not my intended reader.

If you are reading this book and flipping out at every third sentence because you feel I'm insulting your intelligence, then I have three points of advice for you:

  1. Stop reading my book. I didn't write it for you. I wrote it for people who don't already know everything.
  2. Empty before you fill. You will have a hard time learning from someone with more knowledge if you already know everything.
  3. Go learn Lisp. I hear people who know everything really like Lisp.

For everyone else who's here to learn, just read everything as if I'm smiling and I have a mischievous little twinkle in my eye.

:-)

The Octothorpe

I learned another 'really important' thing from Learn Python the Hard Way, on the hash sign #, which it calls 'octothorpe':

An 'octothorpe' is also called a 'pound', 'hash', 'mesh', or any number of names. Pick the one that makes you chill out.

That led me to look at the corresponding Wikipedia entry on the number sign and learn more interesting stuff, such as

The Sharp Glyph

Resemblance to the glyph used in music notation, U+266F, ♯. So called in the name of the Microsoft programming languages C# and F#. However Microsoft says, "It's not the 'hash' (or pound) symbol as most people believe. It's actually supposed to be the musical sharp symbol. However, because the sharp symbol is not present on the standard keyboard, it's easier to type the hash symbol instead. The name of the language is, of course, pronounced 'see sharp'." According to the ECMA-334 C# Language Specification, section 6, Acronyms and abbreviations, the name of the language is written "C#" ("LATIN CAPITAL LETTER C (U+0043) followed by the NUMBER SIGN # (U+0023)") and pronounced "C Sharp".

Anyway, I really find the author of Learn Python the Hard Way pretty funny and very instructive :-)

I hope you find these suggestions useful.