What book or resource would you recommend to learn advanced Python?
(other than python docs)

On Jun 30, 7:49 am, James Bennett <ubernost...@gmail.com> wrote:
> On Mon, Jun 29, 2009 at 5:19 PM, Mark Jones<mark0...@gmail.com> 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" attribute, but under the hood calls a
> method to return the actual value. In this case, Django takes
> advantage of that to tell whether the manager attached to the class is
> being accessed from the class itself or from an instance, and raises
> an exception in the latter case.
>
> > My background is C++ and these look like methods/objects that are
> > static to the class, not part of the instances.  I just can't figure
> > out how to declare and instantiate them in python.
>
> You may want to step back a bit and re-think how you're approaching
> Python; truly "static" class members -- of the type you'd find in C++
> -- are very rarely actually needed/used.
>
> This is actually targeted more at Java folks, but you may want to have
> a look at Phillip Eby's old rant "Python is not Java"; it covers some
> common cases where directly bringing over ideas from other languages
> isn't the best way to approach programming in Python:
>
> http://www.dirtsimple.org/2004/12/python-is-not-java.html
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to