Help with 'self' and 'set_usage'
L O'Shea
lo0446 at my.bristol.ac.uk
Wed Jul 10 04:23:47 EDT 2013
On Tuesday, 9 July 2013 18:03:41 UTC+1, L O'Shea wrote:
> Hi all,
>> I'm interning and have been given the job of extending a program that has been written by someone else. I've never used Python before so it's a bit of a struggle but I've got to say I'm loving the language so far.
>>>> In on of the scripts there is
>>>> def set_usage(self,s):
>> self.usage_str = s
>>>> Could anyone shed some light on this? I can't find mention of this anywhere in any Python documentation or anywhere else in the code where usage_str might be defined. Can you just create variables in that object by writing self.name = "david" self.hobby = "fishing"??
>>>> If this is any help it is used later in the program (or in other scripts) like
>>>> prog.set_usage("""%prog <command> [options] ....""")
>>>> Thanks for your help, I have spent a good while googling python docs, code snippets and reading through a Python book I have on my desk to no avail.
>>>> Cheers in advance.
Thanks for the advice everyone that was really helpful! Gotta love the USA/UK time difference I can post a question here at the end of the day and it be answered by morning - Not that it took any of you very long!
Stay tuned for more Python questions :)
More information about the Python-list
mailing list