codebar / tutorials

🗒 codebar's tutorials
http://tutorials.codebar.io/
260 stars 241 forks source link

Python #149

Closed chrisfranklin closed 8 years ago

chrisfranklin commented 9 years ago

If there was a desire for it I could create Python versions of the Ruby tutorials. For example:

https://github.com/chrisfranklin/tutorials/blob/python-dev/python/lesson1/tutorial.md

(although Learn Python the Hard Way is excellent I think pointing to a much shorter introductory tutorial and then pointing towards LPHW for reference would be better, I'm happy to change it)

despo commented 9 years ago

hi @chrisfranklin - I think that would be great, there is a lot of interest in Python as well.

I think having tutorials similar to the Ruby ones would be great - even though even the Ruby ones are limited. I would be happy to merge that!

donovanglover commented 9 years ago

This would be really cool! I recently finished Learn Ruby The Hard Way and am now looking into learning Python. :smile:

ghost commented 9 years ago

wouldn't be A Byte of Python a better reference than LPHW ?

hairychris commented 9 years ago

So a little update from me, after starting work on this I saw some of the limitations with the Ruby side of the tutorials. The reason for choosing Learn Python the Hard Way was the fact it teaches Python just like Ruby was taught by example in this repository.

I do understand that a lot of people don't like LPHW as they find it too heavy going but I really like the hands on teaching style.

There is the issue that the book has not been updated for Python 3 but for web development purposes (especially if you are using Django) I'd still be hesitant to recommend a new programmer use Python 3. There is still too much broken and putting in pull requests to fix 3rd party packages can be distracting for a new programmer. I believe a Byte of Python is for Python 2.x also.

Thanks for bringing this back to my attention, I'd love to find a way to make this work as well as possible. I'm teaching two close friends to program in Python at the moment and finding it a lot harder than I thought I would. Teaching truly is an independent skill.

It might be worth taking a look at some open courseware stuff like http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/Syllabus/

hairychris commented 9 years ago

I'd also like to bring some web frameworks like Django or Flask into the tutorial as early as possible, almost as soon as basic syntax has been taught.

I feel the two major problems with teaching programming are:

1. Syntax Errors (frustrating)
2. Motivation / Ability to write cool non trivial things quickly (maintaining interest)

So a fine balance between teaching the fundamentals and showing of some of the cool stuff that can be done needs to be struck.

matyikriszta commented 9 years ago

@markdessain sorry, it is an issue rather than a pull request but I think you should get involved!

markdessain commented 9 years ago

Thanks @matyikriszta for adding me in. For reference for anyone else reading, I'm a full time Python developer and in this evenings session Kriszta and myself were talking at a high level about how we could add Python into codebar.

I'm glad @chrisfranklin has started this off and hopefully we can make something of it.

From the points so far I very much agree with @despo about keeping the tutorials inline for Ruby and Python. The languages are similar enough you could easily put them side by side for at least the first few tutorials, creating the same programmes just with the different syntax. Python 2.x and 3.x really does add a bit of extra complexity in (At work we're stuck on 2.6 so I know its a pain!) Although I feel we should cater for 3.x as that is the future.

As far as the example goes, I wouldn't even bother to look into virtualenv or nitrous.io. Install Python on your machine and you're away. We're not going to be installing many libraries during the tutorials, at most I can think of requests and flask (I'd prefer flask to Django as its simple). It's something we can work on though.

hairychris commented 9 years ago

Firstly apologies for not continuing on with this, I've been showing a couple of friends how to use Python and trying to remember what worked for me when I was first getting started.

I do love the idea of keeping the tutorials exactly the same as Ruby to illustrate how the syntax is different but the fundamentals are very similar. That said it would be lovely to be able to cover the following topics:

  1. Fundamentals - virtualenv, python path, python shell, writing script files, variables, string formatting, dot notation, loops, conditionals, functions, methods, properties, classes, inheritance, interfaces, generators, python standard library, types and casting etc etc
  2. Off the ground running - Simple intro to reading from / writing to files, models / schemas, serialisation / deserialisation, databases, basic look at programming patterns and link off to list of examples in Python.
  3. Intro to 3rd party code - Using an API with Requests (text messages with Twilio, using the star wars API, Freebase, whatever), use Jinja2 template language stand alone, Colander schemas, communicating with a Redis server (taking it too far?)
  4. Web applications - some SQLAlchemy, a short bit of Flask and then point in the direction of the 5 main Python web frameworks (Bottle, Django, Flask, Pyramid, Tornado) and discuss strengths / weaknesses and point out best resources for each.
  5. RESTful API in Python - Build an API driven project like this one (http://pharma.hairy.io/api/pharmacy/) and then perhaps we can point off to the Angular tutorials (I remember someone mentioning them? did that happen?)

I know it sounds like a lot of work but I think it would be a good introduction.

Sadly these book are behind a paywall but I do like the topics they cover, I bought them for a friend and can highly recommend them: https://realpython.com

As for leaving out virtualenv I don't believe its the best idea, it would be nice to teach good practice right from the beginning. I know its extra overhead but it does seem important.

Back to the Python 2 / Python 3 issue I think it is important to teach users initially to write code that would run on both (for example print() instead of print) as whilst the code is simple this will not be a problem. Then once the user is getting more confident teach about some of the differences, the pros and cons of each and how to have your cake + eat it.

deniseyu commented 9 years ago

@hairychris @markdessain an update on this - @SamirTalwar and @KimberleyCook wrote the first full-fledged Python tutorial this past week :-)

There are a lot of good ideas in this thread, so it would awesome to see all of these topics touched upon in the upcoming tutorials!

KimberleyCook commented 9 years ago

I want to get more python tutorials up over the next few week so plan on doing one every Wednesday for a few weeks, any input from anyone who is around would be greatly appreciated