Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #50264

Re: Help with 'self' and 'set_usage'

Date 2013-07-09 10:19 -0700
From Ethan Furman <ethan@stoneleaf.us>
Subject Re: Help with 'self' and 'set_usage'
References <de7c4d2c-817e-4237-b312-0795c1c43888@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.4463.1373390374.3114.python-list@python.org> (permalink)

Show all headers | View raw


On 07/09/2013 10:03 AM, L O'Shea wrote:
>
> Hi all,

Howdy!

> 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.

Excellent way to start a question!  :)


> In one of the scripts there is
>
> def set_usage(self,s):
>     self.usage_str = s

Careful of whitespace when posting (I fixed that one for you).


> Can you just create variables in that object by writing self.name = "david" self.hobby = "fishing"??

Yup, you sure can.

--
~Ethan~

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Help with 'self' and 'set_usage' "L O'Shea" <lo0446@my.bristol.ac.uk> - 2013-07-09 10:03 -0700
  Re: Help with 'self' and 'set_usage' Ethan Furman <ethan@stoneleaf.us> - 2013-07-09 10:19 -0700
  Re: Help with 'self' and 'set_usage' Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-07-09 19:24 +0200
  Re: Help with 'self' and 'set_usage' Andrew Berg <robotsondrugs@gmail.com> - 2013-07-09 12:32 -0500
  Re: Help with 'self' and 'set_usage' "L O'Shea" <lo0446@my.bristol.ac.uk> - 2013-07-10 01:23 -0700

csiph-web