python 3 intro presentation for newlug

Download Python 3 Intro Presentation for NEWLUG

If you can't read please download the document

Upload: newlug

Post on 16-Apr-2017

1.176 views

Category:

Technology


3 download

TRANSCRIPT

Python 3 for n00bs

NEWLUG Presentation: June 17th, 2010

Presented by:Ross LarsonSoftware Developer, Cooperative Resources International

So, What is Python, anyways?

Named in honor of Monty Python

Created in the late 80's by Guido van Rossum

Designed to be fun to use, as well as flexible.

Python, a Brief version history

Conceived in the late 80's, implementation started in December 1989

Version 2.0 October 16th, 2000Development shifts to a more transparent, community-backed process

Version 3.0 December 3rd, 2008Backwards incompatible with previous versions

Some developers still choose to use Python 2.6

So, why use Python?

Lots of Stuff Uses it!Django

PyGame

Google App Engine

Quickly

PyQt

PyGtk

Zope

And....more!

OK! Great! I'm in! Now what?

To install Python 3 in Ubuntu, search for python3 and install it via synaptic.

Development can be done either in a text editor like gedit, vim, or gvim

Integrated Development Environments (IDEs) are available, as well (IDLE, PyDev for Eclipse).

I wrote a PyDev install HOWTO on my blog:http://bit.ly/pydev-NEWLUG

Uh, I'm lost! Is there any documentation?

Plenty!Python website (http://docs.python.org/py3k/)

Dive into Python (http://diveintopython3.org)

Koders Code Search (http://www.koders.com/)

YouTube tutorials

Google

IRC channels

The Zen of Python - by Tim Peters

Beautiful is better than ugly.

Explicit is better than implicit.

Simple is better than complex.

Complex is better than complicated.

Flat is better than nested.

Sparse is better than dense.

Readability counts.

Zen of Python, Part 2

Special cases aren't special enough to break the rules.

Although practicality beats purity.

Errors should never pass silently.

Unless explicitly silenced.

In the face of ambiguity, refuse the temptation to guess.

Zen of Python, Part 3

There should be one-- and preferably only one --obvious way to do it.

Although that way may not be obvious at first unless you're Dutch.

Now is better than never.

Although never is often better than right now.

If the implementation is hard to explain, it's a bad idea.

If the implementation is easy to explain, it may be a good idea.

Namespaces are one honking great idea -- let's do more of those!

OK, Let's open up Python3

To open the Python 3 Interpreter, type python3 at the command line.woo@beast:~$ python3Python 3.1.2 (r312:79147, Apr 15 2010, 15:35:48) [GCC 4.4.3] on linux2Type "help", "copyright", "credits" or "license" for more information.>>>

Now, Let's write a simple program!

>>> print("Hello NEWLUG!")Hello NEWLUG!

OK, I'm still with you.

How about variables?>>> newlug = "San Dimas High School Football Rules!">>> print(newlug)San Dimas High School Football Rules!

OK, fine. But what if I don't want to type everything when I run it?

Open a new empty file.

Name it helloNEWLUG.py

Insert:print("Hello NEWLUG!")

Save and Close the file.

OK. Fine. Whatever.

From the command line, type:python3 helloNEWLUG.py

Wow, now I'm a programmer!

Well, kind of. There is quite a bit more to learn.Everything is an Object!

Data types (String, Boolean, Tuple, Dictionary, etc)

Functions

Arguments

User Input

Exception Handling and Redirection

Loops

Soon, this will make sense:

Watch out for....

Indentation and SpacingNever use combinations of tabs and spaces!

If you use both tabs and spaces in a Python program, that makes you a bad person - Brian Blazer

Different Versions of PythonThe default python is often Python 2.6!

Python scripts can be converted to Python 3

The loosey-goosey nature of PythonPython gives you enough rope to hang yourself.

...And now for something completely different

Questions?

Muokkaa otsikon tekstimuotoa napsauttamalla

Muokkaa jsennyksen tekstimuotoa napsauttamallaToinen jsennystasoKolmas jsennystasoNeljs jsennystasoViides jsennystasoKuudes jsennystasoSeitsems jsennystasoKahdeksas jsennystasoYhdekss jsennystaso