Performance penalty for using properties?

John Roth newsgroups at
Sun Mar 14 12:26:55 CET 2004

"Peter Otten" <__peter__ at> wrote in message
news:c3150l$hua$02$1 at

> I think finding a way for properties to access attributes without wrapping
> them into a function call would be worth the effort. The penalty for clean
> interfaces should be as low as possible.

I suspect you're right. If the only reason for using a property is to
hide a simple getter or setter from the client, and provide for
(possible) future more complex processing, then it shouldn't
be necessary to do a function call at all.

Unfortunately, that would require a significant redefinition
of the descriptor interface. If that's done, then I'd strongly
suggest looking at a couple of other issues at the same time.
>From a performance standpoint, keyword (that is, optional)
parameters require a lot more processing than positional
(that is, non-optional) parameters. I know there's been some
talk of trying to optimize function call processing, and property
access should be able to take advantage of any fast paths
through that morass that are created.

> Peter

More information about the Python-list mailing list