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


Groups > comp.lang.python > #16396

Re: Amateur question on class definitions...

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'instance,': 0.05; 'constructor': 0.07; 'brackets': 0.09; 'received:209.85.160.174': 0.09; 'received:mail-gy0-f174.google.com': 0.09; 'am,': 0.12; 'characters:': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'usual:': 0.16; 'syntax': 0.16; 'subject:question': 0.17; 'subject:skip:d 10': 0.17; 'wed,': 0.17; 'wrote:': 0.18; '>>>': 0.18; 'marc': 0.18; 'wrap': 0.18; 'header :In-Reply-To:1': 0.22; 'string': 0.24; 'message- id:@mail.gmail.com': 0.28; 'nov': 0.29; '\xa0\xa0\xa0': 0.31; 'list': 0.32; 'received:209.85.160': 0.33; 'object': 0.33; 'to:addr:python-list': 0.34; 'skip:" 10': 0.37; 'list,': 0.37; 'received:google.com': 0.37; 'using': 0.38; 'some': 0.38; 'received:209.85': 0.38; 'i.e.': 0.39; 'should': 0.39; 'received:209': 0.40; 'to:addr:python.org': 0.40; '2011': 0.61; 'square': 0.67; '30,': 0.74; "'o']": 0.84; 'composite': 0.84; 'edwards': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=8YRV+ihP17MF5rO5xq5/NwRatGgZzF/LvzJqUqis1aI=; b=PzxB2tQnEf7C0zaG83nl32mWNU7E17TJ3wleUTwm86iVyrp1n4+oOuQZ9/w5JgYUkv Mz/5RkOAbmtWkEgdlyRQ8gmKQLQUHqD193JKjHDFJp3sHoBiCa9JnvRzplvEFCQlkljK a4QYWt91mcfx0mfhROxHlHf9Uk6x0cg8QKf7E=
MIME-Version 1.0
In-Reply-To <4ED4F890.70201@gmail.com>
References <4ED4F890.70201@gmail.com>
Date Wed, 30 Nov 2011 02:59:40 +1100
Subject Re: Amateur question on class definitions...
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3129.1322582383.27778.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1322582383 news.xs4all.nl 6876 [2001:888:2000:d::a6]:59239
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16396

Show key headers only | View raw


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


Thread

Re: Amateur question on class definitions... Chris Angelico <rosuav@gmail.com> - 2011-11-30 02:59 +1100

csiph-web