Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16396
| References | <4ED4F890.70201@gmail.com> |
|---|---|
| Date | 2011-11-30 02:59 +1100 |
| Subject | Re: Amateur question on class definitions... |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3129.1322582383.27778.python-list@python.org> (permalink) |
On Wed, Nov 30, 2011 at 2:21 AM, J. Marc Edwards <jmarcedwards@gmail.com> wrote:
> ...a list of "a_workflows", i.e. a composite workflow, should I use this
> syntax?
> set_of_workflows = list(a_workflow)
>
This would be usual:
set_of_workflows = [a_workflow]
Using the list() constructor directly is for when you have some other
iterable; for instance, a string is iterable over its characters:
>>> list("Hello")
['H', 'e', 'l', 'l', 'o']
When you want to wrap up a single object in a list, square brackets
syntax is what you want.
ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Amateur question on class definitions... Chris Angelico <rosuav@gmail.com> - 2011-11-30 02:59 +1100
csiph-web