Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How to use a class property to store function variables?

Thread Tools

How to use a class property to store function variables?

Bruno Desthuilliers
Posts: n/a
GZ a écrit :
> Ah, this totally works. The key is to use the staticmethod function.

staticmethod is not a function, it's a class.

> Another question: I am not sure how staticmethod works internally. And
> the python doc does not seem to say. What does it do?

It's easy to figure this out once you understand how Python turns
functions into methods:

Basically, the staticmethod type acts as a descriptor wrapper around the
function object that short-circuits the function object's own descriptor
implementation and yields the function.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
OO Javascript - Class.Prototype.Property vs. This.Property Spam Catcher Javascript 4 11-21-2007 05:23 PM
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
to store or not to store an image =?Utf-8?B?UnVkeQ==?= ASP .Net 6 03-30-2005 05:51 AM
When/Should we use CssClass property or Style property? Sky ASP .Net Web Controls 2 10-01-2004 07:38 AM