"David Isaac" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> But the default values of function parameters seem rather like a static
> attributes of a class.
> Is that a good way to think of them?

If you think of a function as defining a subclass of execution instances, 
with __init__ inherited from the superclass, then that is a possible way to 
think of them.  Goodness depends on your meaning of goodness ;-).  Does it 
help you write and use Python functions acurately?

> If so, are they somehow accessible?
> How? Under what name?

This is implementation specific.  For CPython, the interactive interpreter 
is your friend.  Learn to use it!

>>> def f(): pass
...
>>> dir(f)
['__call__', '__class__', '__delattr__', '__dict__', '__doc__', '__get__', 
'__ge
tattribute__', '__hash__', '__init__', '__name__', '__new__', '__reduce__', 
'__r
epr__', '__setattr__', '__str__', 'func_closure', 'func_code', 
'func_defaults',
'func_dict', 'func_doc', 'func_globals', 'func_name']

Now give f some parameters with defaults and print f.func_defaults.

Terry J. Reedy



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to