Coding for idiots; which version of Python?

New Topic
This topic has been archived, and won't accept reply postings.
 gethin_allen 11 Sep 2015
I've been trying to put some of my free time to good use by learning a bit of programming, in my last job I was finding my complete lack of command line programming skills a hindrance when performing data processing tasks.
A few people have pointed me towards Python so I'm giving this a go working my way through a few online tutorials.
One thing that people don't seem to agree on is, which version of python should I be working with and if I learn one or the other are they relatively comparable if I needed to use one or the other.

I'm using Python 2.7 at the moment as I've been working through the "learn Python the hard way" tutorials, as recommended by www.python.org

Any hints or recommendations on getting moving with this?

Thanks.
 Ramblin dave 11 Sep 2015
In reply to gethin_allen:

I'd be inclined to say 3.4. The changes from 2.7 are mostly Good Things, and it's going to become more relevant not less relevant over time.

The difficulty of moving from one to the other if you need to is orders of magnitude less than the difficulty of getting basically competent with either, though. And that in turn is orders of magnitude easier than going from basic competence to writing genuinely good code in any language.

I'd recommend having a look at Clean Code by Robert C Martin and Refactoring by Martin Fowler for basic language-independent "writing better code" stuff, and Effective Python by Brett Slatkin for a load of good beyond-the-basics Python stuff.
In reply to gethin_allen:

Ask yourself what the differences between versions are, and if they're really that significant. Since versions seem to be enhancements, I would have thought it sensible to go for the latest stable release. So Python 3 of some variant. On the other hand:

https://docs.python.org/3/faq/general.html#how-stable-is-python

"The latest stable releases can always be found on the Python download page. There are two recommended production-ready versions at this point in time, because at the moment there are two branches of stable releases: 2.x and 3.x. Python 3.x may be less useful than 2.x, since currently there is more third party software available for Python 2 than for Python 3. Python 2 code will generally not run unchanged in Python 3."

If all you want to do is learn to program, just pick one. You can get to grips with the differences later.
 Jack B 11 Sep 2015
In reply to gethin_allen:
First, choose a python version. Since 3.4 is the future, and most of the changes between 2 and 3 are improvements, some of which make things more intuitive and consistent (such as in integer division), I would choose it. But at the end of the day the differences aren't huge. And if you like 'Learn python the hard way' then stick with 2, as that's what's used in those tutorials.

Next, pick a python development environment. A good IDE makes life much easier. You'll learn faster, and you'll be more productive when writing code. What you use might depend a bit on what you want to do. For data wrangling, which to me means scripts not fullblown applications, I like Spyder. For building a computer game or something, maybe Eclipse + appropriate plugins would be better.

Once you've grasped the basics, the best way to learn how to analyse data in python, is to analyse data in python. There's three skills you need, one is to get a hang of how programming works, and how computers think. The second is to learn how Python works and how all the core features fit together. The third is to be familiar with the specific Python modules you need for data analysis (probably numpy, matplotlib, scipy, maybe pandas). If you're analysing data, you're learning the latter at the same time as the first two. Having a project like a big batch of data to analyse also helps keep you working and discovering new things.
Post edited at 18:54
 Mike-W-99 11 Sep 2015
In reply to gethin_allen:

How much python is used in the real world?

I've done loads of perl but more as a tool than development language. Touched on python a bit and it looked a lot more formal and maybe worth a closer look?
 elsewhere 11 Sep 2015
In reply to Mike-W-99:
Python is much bigger than perl these days.

For example...

http://githut.info
Post edited at 20:15
 d_b 11 Sep 2015
In reply to Mike-W-99:

Quite a lot in my experience, but it's often hidden. I used to write a lot of one off data analysis tools with it but haven't had cause to use it for a couple of years.

Getting good at one scripting language will only help you with others anyway - it's the programming mindset that is valuable not the details of the tool.
 Bob 11 Sep 2015
In reply to Mike-W-99:

> How much python is used in the real world?

My editor of choice (Sublime Text) is written in a mixture of C++ and Python plus all the plugins that it uses are written in Python..

 mbh 11 Sep 2015
In reply to gethin_allen:

I have spent much of the last few months trying to get better at Data Science/Analytics/Machine Learning etc, mostly using R and the various products of R Studio. Now I'm also learning Python, motivated initially by it being the scripting language in ArcGis, and I do wonder what the relative advantages/disadvantages are of the two languages for analytics purposes.

I have used MOOCs for all this.

For R I did The Analytics Edge from MIT/EDx, which was great, and the Data Science Specialization from Johns Hopkins University on Coursera - just doing the last course now. Very searching and wide ranging. Worth doing but expect to work hard. You do a LOT of R and you use Git/GitHub.

For Python I did the ridiculously easy but entertaining Programming for Everybody from Michigan University on Coursera, taught by the estimable Charles Severance, and now I am doing MITx600 Introduction to Computer Science and Programming Using Python, which is a whole lot more challenging and time consuming than the Michigan course, but also very grounded in computer science fundamentals, which is what I wanted.

All the Python courses I have come across use 2.7, but it can't be that hard to switch to 3.x if need be once one has grasped how programming, in any language, works.

Good luck!
OP gethin_allen 11 Sep 2015
Thanks all,

As I'm using python as a gateway into coding I may just stick with what I've started with.
It's just such a move from pointing and clicking on stuff I just need to get used to the mindset.

 d_b 11 Sep 2015
In reply to gethin_allen:

If that's your goal then almost any language is good to start. Once you are getting good then learning a couple of others based on different principles is a good exercise. When it comes to programming there is always more than one way to do it and knowing the pros and cons of more than one way will always work in your favour.

New Topic
This topic has been archived, and won't accept reply postings.
Loading Notifications...