Re: Best Pythonic Approach to Annotation/Metadata?

2010-07-16 Thread Christian Heimes
> def to_JSON(self): > returnDict = {} > for member in filter(someMethod, inspect.getmembers(self)): > returnDict[member[0]] = member[1] > return json.dumps(returnDict) By the way you don't need filter here. The getmembers() function has a filter functions. It's cal

Re: Best Pythonic Approach to Annotation/Metadata?

2010-07-16 Thread Chris Rebert
On Thu, Jul 15, 2010 at 12:37 PM, Sparky wrote: > Hello Python community! > > I am building a JSON-RPC web application that uses quite a few models. > I would like to return JSON encoded object information and I need a > system to indicate which properties should be returned when the object > is t

Re: Best Pythonic Approach to Annotation/Metadata?

2010-07-15 Thread Sparky
On Jul 15, 2:26 pm, John Krukoff wrote: > On Thu, 2010-07-15 at 12:37 -0700, Sparky wrote: > > > > > the above is a good "pythonic" way to solve this problem? I am using > > 2.6. > > Hopefully a helpful correction, but if you're running on google app > engine, you're using python 2.5 on the googl

Re: Best Pythonic Approach to Annotation/Metadata?

2010-07-15 Thread John Krukoff
On Thu, 2010-07-15 at 12:37 -0700, Sparky wrote: > the above is a good "pythonic" way to solve this problem? I am using > 2.6. Hopefully a helpful correction, but if you're running on google app engine, you're using python 2.5 on the google side irrespective of what you're running for development

Best Pythonic Approach to Annotation/Metadata?

2010-07-15 Thread Sparky
Hello Python community! I am building a JSON-RPC web application that uses quite a few models. I would like to return JSON encoded object information and I need a system to indicate which properties should be returned when the object is translated to a JSON encoded string. Unfortunately, this appl