Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Tim Chase Newsgroups: comp.lang.python Subject: Re: Parens do create a tuple (was: one-element tuples [Was: Most probably a stupid question, but I still want to ask]) Date: Sun, 10 Apr 2016 19:52:03 -0500 Lines: 26 Message-ID: References: <1460333911.3449208.574628345.4B46CD32@webmail.messagingengine.com> <85r3ed2ctn.fsf_-_@benfinney.id.au> <20160410195203.72e365a9@bigbox.christie.dr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de r7QEZVa7ZCPi2s6v/FgA3wIJRRa+bMTOPa5pYr49g8hw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:question': 0.08; 'subject:create': 0.09; 'subject:still': 0.09; 'tuple': 0.09; 'typeerror:': 0.09; 'subject: \n ': 0.15; '-tkc': 0.16; 'confusion': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'received:10.122': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:Was': 0.16; 'wrote:': 0.16; ';-)': 0.18; '>>>': 0.20; '"",': 0.22; '(most': 0.24; 'header:In-Reply-To:1': 0.24; 'subject: [': 0.29; 'another': 0.32; 'foo': 0.33; 'traceback': 0.33; 'file': 0.34; 'but': 0.36; 'there': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'watch': 0.62; 'here': 0.66; 'obvious': 0.76; 'received:23': 0.84; 'sewing': 0.84; 'too:': 0.84; 'subject:want': 0.93 X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|tim@thechases.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1460336130853:3401653624 X-MC-Ingress-Time: 1460336130852 In-Reply-To: <85r3ed2ctn.fsf_-_@benfinney.id.au> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) X-AuthUser: tim@thechases.com X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20160410195203.72e365a9@bigbox.christie.dr> X-Mailman-Original-References: <1460333911.3449208.574628345.4B46CD32@webmail.messagingengine.com> <85r3ed2ctn.fsf_-_@benfinney.id.au> Xref: csiph.com comp.lang.python:106826 On 2016-04-11 10:45, Ben Finney wrote: > Also, there is another obvious way to create an empty tuple: call > the =E2=80=98tuple=E2=80=99 type directly: >=20 > >>> foo =3D tuple() > >>> print(type(foo), len(foo)) =20 > 0 But here the parens make the tuple too: >>> foo =3D tuple >>> print(type(foo)) >>> len(foo) Traceback (most recent call last): File "", line 1, in TypeError: object of type 'type' has no len() (totally just yanking chains, throwing pebbles in the pond to watch the ripples, and otherwise sewing confusion ;-) -tkc