Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: one-element tuples Date: Mon, 11 Apr 2016 15:40:38 +1000 Lines: 32 Message-ID: References: <851t6d3s0k.fsf_-_@benfinney.id.au> <85bn5h2af9.fsf@benfinney.id.au> <85wpo423bj.fsf@benfinney.id.au> <85r3ec1z55.fsf@benfinney.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de jkvWrWPF+t7sJTdlPT21BgkbDpL2ipiJnK6UxCcwgJTQ== Cancel-Lock: sha1:eReV979d17ngYatSRQyl0pqFsps= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'expressions': 0.07; 'seemed': 0.07; 'exception,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'repl': 0.09; 'tuple.': 0.09; 'example:': 0.10; 'expected,': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'sure.': 0.16; 'surprising': 0.16; 'string': 0.17; '>>>': 0.20; 'not,': 0.22; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'andrew': 0.27; "can't": 0.32; 'getting': 0.33; 'point': 0.33; 'surprised': 0.33; 'list': 0.34; 'clear': 0.35; "isn't": 0.35; 'but': 0.36; "wasn't": 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'thought': 0.37; 'turned': 0.38; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'entire': 0.61; 'below.': 0.66; '_o__)': 0.84; 'confusing': 0.84; 'received:125': 0.84 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: jigong.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) 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: <85r3ec1z55.fsf@benfinney.id.au> X-Mailman-Original-References: <851t6d3s0k.fsf_-_@benfinney.id.au> <85bn5h2af9.fsf@benfinney.id.au> <85wpo423bj.fsf@benfinney.id.au> Xref: csiph.com comp.lang.python:106859 Fillmore writes: > I thought I had made the point clear with the REPL session below. I > had (what seemed to me like) a list of strings getting turned into a > tuple. I was surprised that a single string wasn't turned into a > single-element tuple. Sure. What about the corresponding one from my example: >>> a = "string1" >>> b = "string1", "string2" >>> c = "string1", "string2", "string3" >>> type(a) >>> type(b) >>> type(c) Isn't that just as surprising as the same expressions evaluated with ‘eval’? If not, that's what is confusing me. I can't see how one would be expected, but the other would be surprising. -- \ “It is well to remember that the entire universe, with one | `\ trifling exception, is composed of others.” —John Andrew Holmes | _o__) | Ben Finney