[Python-ideas] A user story concerning things knowing their own names

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Mar 16 10:28:33 CET 2011

I just experienced an obscure bug resulting from copying
and pasting an overridable_property and forgetting to
change the passed-in name:

   content_size = overridable_property('size',
     "Size of the content area.")

which should have been

   content_size = overridable_property('content_size',
     "Size of the content area.")

This was quite difficult to track down, because the result
was to effectively make it an alias of *another* property
I have called 'size'. They happen to be near enough to the same
thing that the error went unnoticed for quite some time.

If I could write my overridable_property declarations
without having to repeat the name, this kind of thing would
not be able to happen.


More information about the Python-ideas mailing list