Jump to content
House Price Crash Forum

Archived

This topic is now archived and is closed to further replies.

InlikeFlynn

Learning Python

Recommended Posts

I'm starting to learn Python for fun.  I have no computer science background, although I am a scientist and  learnt Basic as a teenager, writing programs for my ZX Spectrum (showing my age!).

Before I get too far into it I wanted to pick the collective mind of OT.

I've been enjoying using the free "Learn Python the Hard Way" website, but this is based on Python 2.7 and I'm beginning to think that Python 3 might be a better place to start.  Is this correct?

Can anyone recommend good (preferably free) resources to learn from.

Many thanks

 

 

 

Share this post


Link to post
Share on other sites

I don't know anything about Python (I'm sure someone else here will be able to help) - but I do program for a living - what's re-ignited your interest in it? Is there anything in particular that you want to create?

Share this post


Link to post
Share on other sites

Learn Python3. Its mainly the same, just some language warts hacked off.

Most of the changes are in the hidden class/object model.

Python2 is holding out in some stubborn areas - odds + sods extension packages. Odoo being the most annoying for me.

In answer to Joe, I'd guess his interest is that python is more + more dominant in the number crunching and science. For most researchers is a 'need to' rather than a 'like to'. Mainly due to NumPy.

Most of my casual programming and odds + sods. Its quite remarkable how useless the language and bundled frameworks and libraries are.

I cannot understand why anyone who bangs on about obecjt-orientated languages then goes off and uses a static typed one - C++ or Java..

Share this post


Link to post
Share on other sites
6 minutes ago, spyguy said:

In answer to Joe, I'd guess his interest is that python is more + more dominant in the number crunching and science. For most researchers is a 'need to' rather than a 'like to'. Mainly due to NumPy.

Ah ok cool - mate of mine did a bit of programming as part of his PhD and it was Python that he used actually.

Share this post


Link to post
Share on other sites
1 minute ago, JoeDavola said:

Ah ok cool - mate of mine did a bit of programming as part of his PhD and it was Python that he used actually.

The last 20 odd years have seen lods of fundamental loons, promoting one lnague or another.

C++ (whose problem is which version - C++86, C++91, C++ 98, C++ 2008, C++ 2015? All very different)

Java - Disaster. It should have been much smaller, with very little in the standard distributoin. Bu they had to kitched sink everything and lie about it being secure, when it was one of the most insecure platforms going.

C#. Not too bad. But bad parents. And has gone thru a number of major revisions.

As far as Im concverned, Ill only touch any language that is available as open source and compiles from ANSI C.

My reasons are that software i so expensive you have to plan for 10-15 years to get your moneys worth.

Over the years, Ive had to pick up so much crap where bits or test tools have been written i an elaborate combination of lnaguges no longer avilable, or libraries that dont work on a newer platforms, or where the test platform is garbasge and did not work.

 

 

Share this post


Link to post
Share on other sites
1 minute ago, spyguy said:

Over the years, Ive had to pick up so much crap where bits or test tools have been written i an elaborate combination of lnaguges no longer avilable, or libraries that dont work on a newer platforms, or where the test platform is garbasge and did not work.

This used to be the bane of my life. Brand new frameworks being used needlessly because of a mixture of nerdy-types who almost seem to make everything an uphill struggle if they can then show off their new knowledge of a framework that no-one else knows about, or sales types wanting to impress a customer with the 'latest technology'.

Then 3 years on no bugger is using that any more, and you have something that's meant to be in production long term. Nightmare when someone else has to come around and update it. I'm currently putting together a post about this on the other development topic - you can let me know what you think.

Share this post


Link to post
Share on other sites

Perl is the bane of my life. Sh1t lnaguge. Numerous sh1t add-ons. Written by idiots.

What tnuc decided it was useful or maintainable for anything.

Followed by shell scripts - normally bash, which are non compatible and are soo wordly I have to wade thru about 100 lines of cr.p for somehting I could do in a couple of lines.

 

 

Share this post


Link to post
Share on other sites
4 minutes ago, JoeDavola said:

This used to be the bane of my life. Brand new frameworks being used needlessly because of a mixture of nerdy-types who almost seem to make everything an uphill struggle if they can then show off their new knowledge of a framework that no-one else knows about, or sales types wanting to impress a customer with the 'latest technology'.

Then 3 years on no bugger is using that any more, and you have something that's meant to be in production long term. Nightmare when someone else has to come around and update it. I'm currently putting together a post about this on the other development topic - you can let me know what you think.

I have some very simple rules which, like, exercise and not eating too much, are ignore by 99.999% of people.

 

Share this post


Link to post
Share on other sites

Many thanks for all the replies.

Joe, I'm interested in learning largely for the sake of it. I'm hoping it will be good fun and brain exercise as I'm looking after kids and renovating my house at the moment so my brain is not being used as much as it should be. I have a couple of simple programs that I want write, one which uses string inputs to develop some (hopefully funny and useful) output text.  The second will use user inputs to process some ONS data to give an output.  Both programs will be very simple but I want the to take their inputs from a web form and present the outputs on a results page. 

Thanks Spyguy, I'll go for Python 3.

Dgul, thanks for the Raspberry Pi link - I gave my son one a few years ago that he has never used. I'll browse through the magazines and see what I can find. There's a lot there!

 

Share this post


Link to post
Share on other sites
13 minutes ago, InlikeFlynn said:

Joe, I'm interested in learning largely for the sake of it. I'm hoping it will be good fun and brain exercise as I'm looking after kids and renovating my house at the moment so my brain is not being used as much as it should be.

As good a reason as any. Programming is a fantastic thing to be able to do, and the possibilities are endless. Good on ya.

Share this post


Link to post
Share on other sites
2 hours ago, spyguy said:

Perl is the bane of my life. Sh1t lnaguge.

 

 

If Carlsberg did HPC posts :D

Spot the inconsistency.

Share this post


Link to post
Share on other sites

I mean this in a nice way - asking which language to use when you start programming is a bit like asking which car to drive when you're learning to drive. 

The most important thing is that you're driving, and, to a certain extent, any old thing will do as the car. Some people might think that learning in a car with no power steering, no traction control, and no ABS would be best (C, C++, assembler), because you're closer to real driving. Some people might think that all the extra electronic aids (Java, Python) are useful because you're building confidence in a safer easier way. Some cars are so far away from real driving (Perl, Basic) that they'll possibly taint your learning experience. Some cars are self-driving (Haskell, Erlang, Prolog) so perhaps better to learn how they do what they do before learning them.

But driving is the thing. Learn to drive something well and you've learnt 95% of what's important for driving other vehicles. Programming languages are just like cars. They all have wheels, an engine, and a brake pedal. At one level they're all the same. They just differ in shape, performance, weight, the way you get to control them, and how difficult or easy they make it to do what you want to do.

Equally, when you drive socially or professionally, you're going to want to choose a vehicle which fits in with how you want to use it. If you want to lug around concrete blocks, best avoid a smart car. So choosing the language for a real commercial application is going to have many more constraints (mainly imposed by "what's already there") than choosing one to learn in.

Specifically on this question, I think Python is as good a place to start as any, and a lot better than some. Happy travels!

Share this post


Link to post
Share on other sites
16 minutes ago, sPinwheel said:

I want to eventually build apps. On Android originally. Where to start? Anyone here written any android apps before?

Well, to do it 'properly' use Java.  Download Android Studio and give it a go.  Easy to get started.  Java is nice if you've used C before (lots of people don't like it, but I think it is fine).

[But loads of people use easier frameworks these days -- phonegap is one. But I program in Java for Android where I need it (access to hardware stuff) and just do it all offline with a web-based viewer for simple stuff (rather than use these cross-platform tools).]

 

Share this post


Link to post
Share on other sites
7 hours ago, InlikeFlynn said:

I'm starting to learn Python for fun.  I have no computer science background, although I am a scientist and  learnt Basic as a teenager, writing programs for my ZX Spectrum (showing my age!).

Before I get too far into it I wanted to pick the collective mind of OT.

I've been enjoying using the free "Learn Python the Hard Way" website, but this is based on Python 2.7 and I'm beginning to think that Python 3 might be a better place to start.  Is this correct?

Can anyone recommend good (preferably free) resources to learn from.

Many thanks

I found "Dive Into Python" was a great book - you can read it online for free. I believe it's been updated for Python 3.

If you're writing a "few simple scripts" then the differences between Python 2 and 3 will be almost completely under your radar. I'd say go for 3, simply because at some point in the future 2.7 will be end-of-lined. The only potential issue is if you start using 3rd party libraries written in Python - some of these are still not compatible with Python 3 :(

Share this post


Link to post
Share on other sites
13 minutes ago, Inoperational Bumblebee said:

Watching with interest.

I've dipped into Python a couple of times over recent years but just get bored with the earlier lessons as they don't appear to achieve much. I'm considering that either I'm not cut out for programming, or I should try something harder...

IMO you need to have a goal, some final thing you need to achieve through the programming.  Without this is all becomes a bit aimless.  If you're really interested read some MagPi magazines and think of a potential fun thing to do.

Another interesting way to start off is to use Arduino -- IMO there is a really powerful thing about making things happen in the 'real world', and the various Arduino shields make this easy.  Okay, not Python, but a nice simple procedural language to get to understand the basics of programming.

Share this post


Link to post
Share on other sites
48 minutes ago, sPinwheel said:

I want to eventually build apps. On Android originally. Where to start? Anyone here written any android apps before?

I've got an app on Google Play and I've just worked on a phonegap app for my company although I did the backend stuff not the phonegap side.

I've used phonegap, it is a good solution if you are doing a front end to some existing website or services that isn't pushing the bleeding edge too much (it is essentially HTML with some native stuff under the covers to interface to the platform (IOS or Android).

Share this post


Link to post
Share on other sites
3 minutes ago, dgul said:

IMO you need to have a goal, some final thing you need to achieve through the programming.  Without this is all becomes a bit aimless.  If you're really interested read some MagPi magazines and think of a potential fun thing to do.

I've been told this before, and I was just about to do so in my previous job (Python appeared perfect!) when my current job was advertised and I got it. Completely different field so no opportunity for work purposes really. Amusingly enough, I am now surrounded by programmers...

Sorry for a bit of a hijack, but our wireless thermostat needs replacing so I was considering building something web-enabled. Could I do this with a Pi (I already have one), or would an Arduino be better suited?

Share this post


Link to post
Share on other sites
7 hours ago, spyguy said:

 Java... lie about it being secure, when it was one of the most insecure platforms going.

 

 

I doubt there is much in the security issues of the JVM that have affected any apps written in Java in the last decade.

Share this post


Link to post
Share on other sites

As a data scientist my bread and butter languages are SQL and R. I'm thinking of learning Python too, it's syntax seems a bit more human readable than R for instance . Also there has been a vast improvement in the packages available  (a strength R has ) for a wide range of applications.  python seems particularly suitable for text processing,   streams of data input and processing.  pretty nifty language. 

There's quite a few free courses on Datacamp / Coursera still available that you access to learn the basics.

Sources of specific help will be sites like Stackoverflow

Share this post


Link to post
Share on other sites
1 hour ago, Inoperational Bumblebee said:

I've been told this before, and I was just about to do so in my previous job (Python appeared perfect!) when my current job was advertised and I got it. Completely different field so no opportunity for work purposes really. Amusingly enough, I am now surrounded by programmers...

Sorry for a bit of a hijack, but our wireless thermostat needs replacing so I was considering building something web-enabled. Could I do this with a Pi (I already have one), or would an Arduino be better suited?

Pi would be overkill for something so simple.  Traditional approach would be the Arduino locally working with xbee/zigbee to a central server ( in the house, possibly pi) doing lots of stuff and connecting to the internet.  You could do Arduino + wifi hat but it is difficult to get this sort of combo to do anything substantial re. the interface.

This sounds madness, as it is a more complex solution than just using the pi (ie, 'pi would be overkill', my opening words), but it turns out that microcontrollers are much better at the hardware interfacing stuff than complete computers (pi).  Frankly, even if you wanted to do away with the xbee and have a pi do only the thermostat, you'd still be better off having the arduino (nano would do) do temperature monitoring and the actual switching, connected to the pi via usb.

Advantage of arduino/xbee is that you can easily have multiple sensors around the house and monitor temperature properly, rather than just in the hall.

[Obviously you'd be better off buying a nest/hive and doing it that way -- only proceed for the fun of it.]

Share this post


Link to post
Share on other sites
2 hours ago, davidg said:

I doubt there is much in the security issues of the JVM that have affected any apps written in Java in the last decade.

Youd hope so but you'd be wrong.

Share this post


Link to post
Share on other sites

  • Recently Browsing   0 members

    No registered users viewing this page.

  • The Prime Minister stated that there were three Brexit options available to the UK:   65 members have voted

    1. 1. Which of the Prime Minister's options would you choose?


      • Leave with the negotiated deal
      • Remain
      • Leave with no deal

    Please sign in or register to vote in this poll. View topic


×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.