[Edu-sig] quantum instance

Dethe Elza delza at livingcode.org
Wed Sep 14 06:27:49 CEST 2005

On 13-Sep-05, at 7:22 PM, Arthur wrote:

> My argument though is with you, not Guido.  It is about use cases for
> existing features, not about the features themselves.  And in the
> particular case of properties, it was only in going back to Guido's  
> own
> use case illustration that I begin to develop some comfort with why
> properties are there - why they are a neat solution to a limited  
> set of
> problems.  I understand them now more in  terms  of  something akin to
> a GUI event, or a SQL trigger.  You  have a need  to know  when
> something  attempts to set or  get  a particular attribute. The  
> relation
> to the actual attribute might be tenous.  It's an event.  It might  
> begin
> a process that sends an e-mail to Mary. Who knows what. Its all quite
> practical and tangible stuff, though.

As Guido has said, properties don't do anything that couldn't be done  
before with __getattr__ and __setattr__, they just give a cleaner  
syntax for it.  Since VPython makes extensive use of __getattr__ and  
__setattr__, do you think you would like the package more or less if  
they used properties instead?  Or perhaps if instead of (I don't  
actually remember if VPython allows named colours, but bear with me  
for this example):

ball = sphere(color=blue)
# a blue sphere appears on the screen
ball.color = 'red'
# the ball changes instantly to red

would this be better if we wrote:

ball = sphere(color='blue')

does that make it more readable, or less?


"Trusting a scientist on questions of metaphysics is like paying  
someone else to worship God for you." -- Bill Welton

More information about the Edu-sig mailing list