Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16396 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2011-11-30 02:59 +1100 |
| Last post | 2011-11-30 02:59 +1100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Amateur question on class definitions... Chris Angelico <rosuav@gmail.com> - 2011-11-30 02:59 +1100
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2011-11-30 02:59 +1100 |
| Subject | Re: Amateur question on class definitions... |
| Message-ID | <mailman.3129.1322582383.27778.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web