Functions attributes accessed from within the function definition URGENT please
aleaxit at yahoo.com
Wed May 30 17:11:09 CEST 2001
"dsavitsk" <dsavitsk at e-coli.net> wrote in message
news:Uk7R6.1617$6t.1421996 at newsrump.sjc.telocity.net...
> is this what you are after?
> def f(x=31426):
I think this would be an ARGUMENT, while Fernando is
asking about an ATTRIBUTE:
> "Fernando Rodríguez" <spamers at must.die> wrote in message
> news:o70aht0nl21e323pfkmgj0p6sabhm7q6f3 at 4ax.com...
> > Hi!
> > I have a function f that will have an attribute x: f.x = 31426 (for
> > example).
> > When defining the function f, I'd like to give this attribute a
> > default value, so I'll never get an error when trying to access it with
and then the answer is, e.g.:
f.x = 31426
I.e., set f's attributes with normal syntax just AFTER the
def statement that binds the name f to the function object.
More information about the Python-list