Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python descriptors are not transparent when they're first used

Cole Tuininga wrote:
> What you've done is to set the attributes, Foo.baz, and Foo.quux
> to instances of the WriteOnly class.  However, because is a
> reference (just like everything in Python), doing this:
> = 4
> overrides the 'bar' attribute of the instance known as foo.  It is no
> longer a 'WriteOnly' instance.  If you did a print str(type(,
> it would report that it is now an instance of an Integer object.

Crap.  I thought " = 4" would automagically be translated to
", 4)".

I have *completely* misunderstood the documentation for descriptors.
What's the point of all that __get__, __set__, and __delete__ magic?

This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!

Boston Linux & Unix /