Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50266
| Date | 2013-07-09 12:32 -0500 |
|---|---|
| From | Andrew Berg <robotsondrugs@gmail.com> |
| Subject | Re: Help with 'self' and 'set_usage' |
| References | <de7c4d2c-817e-4237-b312-0795c1c43888@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4465.1373391134.3114.python-list@python.org> (permalink) |
On 2013.07.09 12:03, L O'Shea wrote: > 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. In Python, you don't declare or initialize variables before using them. In the example you gave, that is where usage_str is defined. You simply assign an object to a name or attribute (which may or may not have existed previously). You can then change it to anything else you want; Python is dynamically typed, so the object you assign to it can be of any type. Note: a class with __slots__ defined is the exception to this, but that's a bit of an advanced topic. BTW, you can play with objects in the interactive interpreter. It's a great way to quickly learn how certain things work. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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