By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,154 Members | 1,056 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,154 IT Pros & Developers. It's quick & easy.

Re: property getter with more than 1 argument?

P: n/a
I don't understand what you're trying to do here.
On Thu, Jul 17, 2008 at 10:57 AM, mk <mr****@gmail.comwrote:
It seems like getter is defined in such way that it passes only 'self':
class FunDict(dict):
def __init__(self):
self.fundict = dict()

def fget(self, fun):
return fundict[fun.func_name]

def fset(self, newfun):
self.fundict[newfun.func_name] = newfun

newfun = property (fget, fset)




Traceback (most recent call last):
File "<pyshell#67>", line 1, in <module>
TypeError: fget() takes exactly 2 arguments (1 given)

Is it possible to pass more than one argument to fget function?

I know: I can define a function with property name ('newfun' in the example)
and call it with more arguments. But then I do not get the benefits of
setter and property in general!

Jul 17 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.