As someone who jumped in as new to python, and  django both.  I'd say
you won't have much trouble, if you're comfortable with another
language.  You can start out knowing nothing about it, but you'll need
some basics pretty quickly.  Things about Python that I wish I'd
focused on before starting with django...

Lists, and List comprehensions.  [(m.id,m.name) for m in Model] for
example

None,[],{},'',False, and NULL.  Little things, but hard to track down
if you misuse.

Reference.  Everything is by reference, so when modifying variables
keep that in mind. or it can hurt.

Dictionaries.  .copy() and .deepcopy().  Everything is by reference!
** in front of a dict can expand it so you can use a dict to generate
function
keyword arguments: fuction(a=1,b=2,c=3) is the same as dict={'a':1,'b':
2,'c':3} and then function(**dict).  This is really handy.  Keys are
any immutable object, so you can even do things like use a class
definition or a function as a key.
dict.get('name',value_if_not_present).

When things get evaluated. Most things get evaluated when the module
is loaded, not on every view.  So if you are doing dynamic choices for
example it takes a little different approach since defining them in
the class definition will only evaluate them once when the class is
first interpreted, not each time an instance is created.

class __init__(*args,**kwargs), and super().  You'll need them. args
is a tuple of non-keyword, kwargs is a dict.  Any changes you want
done to a class, but on a per-instance basis are done here.  Like
specifying dynamic choices.

iPython.  First thing after django you should install.  Specifically
the dir and vars functions which let you inspect objects
interactively, and even write/test code snippets before putting them
in your project.

Django code.  Don't be afraid of it, it's well commented and not
nearly as complicated as you might expect.  It really helped me to
look at the newforms library, looking up pythonisms that I didn't
understand.

tuples: ('value') is not the same as ('value',).  Always toss in that
trailing comma.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to