| Deutsch English Français Italiano |
|
<vb3rka$21vqv$1@solani.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Mild Shock <janburse@fastmail.fm> Newsgroups: comp.lang.python Subject: Re: Python told me a Joke Date: Mon, 2 Sep 2024 10:05:30 +0200 Message-ID: <vb3rka$21vqv$1@solani.org> References: <868qwafq1o.fsf@williamsburg.bawden.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 2 Sep 2024 08:05:30 -0000 (UTC) Injection-Info: solani.org; logging-data="2162527"; mail-complaints-to="abuse@news.solani.org" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.18.2 Cancel-Lock: sha1:vRf1Zb11Ln9UTT5dmdGsOIMPuBc= In-Reply-To: <868qwafq1o.fsf@williamsburg.bawden.org> X-User-ID: eJwFwYEBwCAIA7CXZgsFz0GU/09Y4tRSh8llPj7aB+Rs5q0MoOBXyAq9s+6qalbg1T14nA6aMrx604Kf4QdOfxUu Bytes: 2174 Lines: 43 You can try: >>> 1,2 == 2,2 (1, True, 2) Its the same as: >>> 1, (2 == 2), 2 (1, True, 2) Hope this helps! Alan Bawden schrieb: > Python 3.10.5 (v3.10.5:f37715, Jul 10 2022, 00:26:17) [GCC 4.9.2] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> x,_,z = [1,2,3] > > Works as expected. > > Now I didn't expect the following to work (but Python sometimes > surprises me!), so I tried: > > >>> x,2,z = [1,2,3] > File "<stdin>", line 1 > x,2,z = [1,2,3] > ^^^^^^^^^^^ > SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='? > > Yeah, that makes sense, no surprises today... Except "maybe you meant > '=='..." caught my attention. _Could_ that be what someone would want > in this situation I wondered? So I tried: > > >>> x,2,z == [1,2,3] > (1, 2, False) > > Now that made me laugh. > > - Alan > > [ Some people reading this will be tempted to explain what's really > going on here -- it's not hard to understand. But please remember that > a joke is never funny if you have to explain it. ] >