Using eval, or something like it...

r0g aioe.org at technicalbloke.com
Fri Nov 21 18:40:52 EST 2008


Scott David Daniels wrote:
> I forgot to include a few cases:
> 
> (1) Inspired by your calling the class attributes "templates":


I did no such thing, I likened classes to templates and as far as I can
tell they are _like_ templates albeit dynamic ones.


>     class Demo3(object):
> All the above to demonstrate the class storage and instance storage
> are separate.

I see that.

> (2) Trickier stuff involving sharing:
>     class Demo4(object):

Yeah no s*** that's trickier! Still haven't quite wrapped my head round
it yet even after reading the 'language definitions carefully' (well
http://www.python.org/doc/2.5.2/tut/node11.html at least) although I am
a bit clearer about the difference between class attributes and instance
variables. Time to go rewrite some crappy old code!



> They are meant to point out that you need to read language definitions
> carefully, or you will breeze by thinking you understand something you
> really do not understand.

One of the things I love about Python is how it allows you to just
breeze by on intuition alone! It makes it immediately (and
incrementally) useful in the real world and I've been ableto built up a
great little library of scripts as I've learned. Having said that I
appreciate bigger projects require a deeper understanding which is why I
hang out here and occasionally ask dumb questions. Thankfully from time
to time clever bods like you will spot and point out the gaps in my
knowledge.

Cheers,

Roger.



More information about the Python-list mailing list