Debugging difficulty in python with __getattr__, decorated properties and AttributeError.
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sat May 4 02:29:22 EDT 2013
On Fri, 03 May 2013 13:52:23 +0600, Mr. Joe wrote:
> Thanks for clearing up. Developers of python should address this issue,
> in my opinion. 3.4/3.5 maybe, but better late than never.
>
> Recently, I've been beaten back for using some exotic features of
> python.
What do you consider "exotic"? Neither properties nor __getattr__ are
exotic, although of course like all features of a language they have
their own quirks.
> One is this[ Took me hours to get to the bottom ].
Well, of course hindsight is 20:20, and I don't know how complicated your
actual code is, but "hours" seems a bit poor. I could believe half an
hour. Maybe an hour. But of course everything is easy to the guy who
doesn't have to do it.
> The other one
> is 'property' decorator. I was using it extensively until I needed to
> make a child class. Then I came to know that 'property' does not play
> well with polymorphic code. :(
I don't understand what you are trying to say. Properties can be as
polymorphic as any other Python function.
> I resorted to some lambda hacks learned
> from stackoverflow.com to solve the problem.
That's not a good sign. Any sentence containing "hacks" and
"stackoverflow" is a warning that you're probably doing something wrong.
--
Steven
More information about the Python-list
mailing list