Deutsch English Français Italiano |
<868qwafq1o.fsf@williamsburg.bawden.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!bawden.eternal-september.org!.POSTED!not-for-mail From: Alan Bawden <alan@csail.mit.edu> Newsgroups: comp.lang.python Subject: Python told me a Joke Date: Mon, 02 Sep 2024 03:55:15 -0400 Organization: ITS Preservation Society Lines: 29 Message-ID: <868qwafq1o.fsf@williamsburg.bawden.org> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Mon, 02 Sep 2024 09:55:21 +0200 (CEST) Injection-Info: bawden.eternal-september.org; posting-host="211663326ffa3036f3c2b0d6e67aa0dd"; logging-data="2001562"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Ep+NcG+5ITKNkuzgpG0An" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:gyU/tLgjGP5isJAxQ7xEyJJ19MY= sha1:AsP56DbsZs5ZcQu37nxi6WiDne4= Bytes: 1858 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. ]