[Tutor] Languages, was Which programming language is better
dman
dman@dman.ddts.net
Thu, 28 Mar 2002 18:40:18 -0600
On Thu, Mar 28, 2002 at 03:13:18PM -0800, Kirby Urner wrote:
| Well, if they're class methods, then you probably don't
| want to obliterate them by making them integers --
| it's up to you.
How about this?
class Demo( object ) :
def _set_f( self , v ) :
self._f = v
def _get_f( self ) :
return self._f
f = property( _get_f , _set_f , None , "the 'f' property" )
myreallylongname = Demo()
o = myreallylongname
o.f = 1
o.f
In versions of python prior to 2.2 this can be achieved by a not so
pretty __getattr__ and __setattr__ pair.
-D
--
Stay away from a foolish man,
for you will not find knowledge on his lips.
Proverbs 14:7