Re: Trying to understand Django and Python from a C++ perspective

2009-06-30 Thread Lachlan Musicman
On Wed, Jul 1, 2009 at 06:02, zweb wrote: > > What book or resource would you recommend to learn advanced Python? > (other than python docs) "How to think like a computer scientist": http://www.greenteapress.com/thinkpython/ -- "I'm in IT and we generally know how to use

Re: Trying to understand Django and Python from a C++ perspective

2009-06-30 Thread zweb
What book or resource would you recommend to learn advanced Python? (other than python docs) On Jun 30, 7:49 am, James Bennett wrote: > On Mon, Jun 29, 2009 at 5:19 PM, Mark Jones wrote: > > What is the python Magic going on here to make this possible?

Re: Trying to understand Django and Python from a C++ perspective

2009-06-30 Thread James Bennett
On Mon, Jun 29, 2009 at 5:19 PM, Mark Jones wrote: > What is the python Magic going on here to make this possible? So, you want to read up on how Python descriptors work. One application of a descriptor is the ability to create something which behaves like a "normal"

Re: Trying to understand Django and Python from a C++ perspective

2009-06-30 Thread Jeff FW
You can actually do something like it fairly simply, by using the classmethod decorator, like so: class Thing: @classmethod def do_something(cls, some_arg): # do something with some_arg Then you could call it: Thing.do_something(3) Notice that you don't pass the "cls"

Re: Trying to understand Django and Python from a C++ perspective

2009-06-29 Thread Mark Jones
Yea, I'm not wanting to use stuff.objects, but I'm wanting to pull some of the same voodoo, probably not safe for a python novice like myself :-) On Jun 29, 5:24 pm, Alex Gaynor wrote: > On Mon, Jun 29, 2009 at 5:19 PM, Mark Jones wrote: > > > I can't

Re: Trying to understand Django and Python from a C++ perspective

2009-06-29 Thread Alex Gaynor
On Mon, Jun 29, 2009 at 5:19 PM, Mark Jones wrote: > > I can't seem to reason out why/how this works. > > I have a class Named Stuff > > I can say Stuff.objects.filter(.) and that will return valid set > of data. > > What I can't understand is what exactly is objects, and

Trying to understand Django and Python from a C++ perspective

2009-06-29 Thread Mark Jones
I can't seem to reason out why/how this works. I have a class Named Stuff I can say Stuff.objects.filter(.) and that will return valid set of data. What I can't understand is what exactly is objects, and why is it I can call it with Stuff.objects, but I can't call it with stuff.objects (an