Wow, I can't believe I just now discovered this.

If anyone else reading this is curious, there's a more info here:

http://docs.python.org/library/functions.html#property

Thanks!

On Jun 2, 5:17 pm, "Diez B. Roggisch" <[email protected]> wrote:
> Ryan Michael schrieb:
>
> > Hmmm.   Where can I read more about the '@property' bit - I can't seem
> > to find it in the Turbogears or SQLAlchemy documentation.  How would I
> > use this syntax to define 'set' methods?
>
> Because it's standard python, nothing to do with TG/SA/Elixir.
>
> mac-dir:~ deets$ python
> imporPython 2.6 (r26:66714, Mar 26 2009, 21:47:26)
> [GCC 4.2.1 (Apple Inc. build 5566)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> Welcome to rlcompleter2 0.96
> for nice experiences hit <tab> multiple times
>  >>> help(property)
>
> I use a trick for defining getters/setters which doesn't pollute the
> namespace:
>
> @apply
> def foo():
>      def fget(self):
>          return self._whatever
>      def fset(self, value):
>          self._whatever = value
>      return property(**locals())
>
> Diez
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to