The subclass needs a way to access parent class.

super

is the parent class.

—-

def save(self):

# do something specific customized actions for the model

super(Card, self).save()  #perform parent class’s save

——-

get( )

is a method available on any Python dictionary, letting you ask for the value of a particular key and specify a default to fall back on if the key doesn’t exist.

e.g.,

query=request.GET.get(‘q’,”)

If there is no q, then query becomes empty string.

use brackets

e.g.,

request.GET['q']

For classes:

use capitalized names, camel-style for multiword names

e.g., Context, HttpResponse

For modues, funtions and normal variables:

use lowercase names and underscore to seprate multiple words,

e.g., get_absolute_url

Python functions have no explicit begin or end, and no curly braces to mark where the function code starts and stops. The only delimiter is a colon (:) and the indentation of the code itself.

This corresponds with def and if etc.

For example,

def fib(n):                   1
    print 'n =', n            2
    if n > 1:                 3
        return n * fib(n - 1)
    else:                     4
        print 'end of the line'
        return 1

There are two ways to make comments in Python.

1.

# single line comment

2.

“”"

multiple line comments

here

“”"

Go

http://www.pythonware.com/products/pil/

PIL

is

Python Imaging Library.

It is needed for many other tools/plugins (e.g., image uploader etc.)

Download the Windows installer (.exe) from PyPI: http://pypi.python.org/packages/any/M/Markdown/Markdown-2.0.win32.exe

Beautiful Soup

is a Python HTML/XML parser designed for quick turnaround projects like screen-scraping.

Looks good for blogging export/import tool.

© 2011 Web Oom Suffusion theme by Sayontan Sinha
Switch to our mobile site
Page 3 of 4«1234»Top Footer