adding attributes to a function, from within the function
From: Fernando Rodriguez (frr_at_easyjob.net)
Date: 10/31/03
- Next message: Fernando Rodriguez: "Access the methods of a class"
- Previous message: afds: "Re: Regular Exp"
- Next in thread: Sean Cody: "Re: adding attributes to a function, from within the function"
- Reply: Sean Cody: "Re: adding attributes to a function, from within the function"
- Reply: Werner Schiendl: "Re: adding attributes to a function, from within the function"
- Reply: Alex Martelli: "Re: adding attributes to a function, from within the function"
- Reply: Shu-Hsien Sheu: "Re: adding attributes to a function, from within the function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 31 Oct 2003 17:05:21 +0100
Hi,
What's the syntax to add an attribute to a function form the function body?
For example, instead of doing:
def fn():
return 1
fn.error = "Error message"
print fn.error
I'd like to do something like this:
def fn():
error = "Error message"
return 1
print fn.error
How can I do this? O:-)
TIA
- Next message: Fernando Rodriguez: "Access the methods of a class"
- Previous message: afds: "Re: Regular Exp"
- Next in thread: Sean Cody: "Re: adding attributes to a function, from within the function"
- Reply: Sean Cody: "Re: adding attributes to a function, from within the function"
- Reply: Werner Schiendl: "Re: adding attributes to a function, from within the function"
- Reply: Alex Martelli: "Re: adding attributes to a function, from within the function"
- Reply: Shu-Hsien Sheu: "Re: adding attributes to a function, from within the function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|