Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100995
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: how to get names of attributes |
| Date | 2015-12-30 14:16 +0000 |
| Message-ID | <mailman.72.1451485018.11925.python-list@python.org> (permalink) |
| References | <n60gfk$b0t$1@dont-email.me> <n60jb6$hln$2@dont-email.me> <mailman.69.1451479806.11925.python-list@python.org> <n60mcc$rtp$1@dont-email.me> |
On 30/12/2015 13:31, Charles T. Smith wrote:
>
> I wonder what the difference is between vars() and items()
>
Not much. From https://docs.python.org/3/library/functions.html#vars
<quote>
vars([object])
Return the __dict__ attribute for a module, class, instance, or any
other object with a __dict__ attribute.
Objects such as modules and instances have an updateable __dict__
attribute; however, other objects may have write restrictions on their
__dict__ attributes (for example, classes use a dictproxy to prevent
direct dictionary updates).
Without an argument, vars() acts like locals(). Note, the locals
dictionary is only useful for reads since updates to the locals
dictionary are ignored.
</quote>
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
how to get names of attributes "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2015-12-30 11:51 +0000
Re: how to get names of attributes Chris Angelico <rosuav@gmail.com> - 2015-12-30 22:58 +1100
Re: how to get names of attributes "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2015-12-30 12:16 +0000
Re: how to get names of attributes Chris Angelico <rosuav@gmail.com> - 2015-12-30 23:34 +1100
Re: how to get names of attributes "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2015-12-30 12:40 +0000
Re: how to get names of attributes Chris Angelico <rosuav@gmail.com> - 2015-12-30 23:50 +1100
Re: how to get names of attributes "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2015-12-30 13:31 +0000
Re: how to get names of attributes Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-30 14:16 +0000
Re: how to get names of attributes Chris Angelico <rosuav@gmail.com> - 2015-12-31 00:45 +1100
Re: how to get names of attributes Random832 <random832@fastmail.com> - 2015-12-30 12:04 -0500
Re: how to get names of attributes Chris Angelico <rosuav@gmail.com> - 2015-12-31 09:26 +1100
Re: how to get names of attributes Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-30 14:10 +0000
Re: how to get names of attributes "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2015-12-30 14:50 +0000
Re: how to get names of attributes Steven D'Aprano <steve@pearwood.info> - 2015-12-31 10:58 +1100
Re: how to get names of attributes "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2015-12-31 10:46 +0000
csiph-web