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


Groups > comp.lang.python > #47701 > unrolled thread

A certainl part of an if() structure never gets executed.

Started byΝικόλαος Κούρας <nikos.gr33k@gmail.com>
First post2013-06-11 13:20 -0700
Last post2013-06-14 15:31 +0300
Articles 20 on this page of 171 — 44 participants

Back to article view | Back to comp.lang.python


Contents

  A certainl part of an if() structure never gets executed. Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-11 13:20 -0700
    Re: A certainl part of an if() structure never gets executed. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-11 23:14 +0100
    Re: A certainl part of an if() structure never gets executed. MRAB <python@mrabarnett.plus.com> - 2013-06-11 23:43 +0100
      Re: A certainl part of an if() structure never gets executed. nagia.retsina@gmail.com - 2013-06-11 18:25 -0700
        Re: A certainl part of an if() structure never gets executed. Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-11 18:46 -0700
          Re: A certainl part of an if() structure never gets executed. alex23 <wuwei23@gmail.com> - 2013-06-11 18:57 -0700
            Re: A certainl part of an if() structure never gets executed. Chris Angelico <rosuav@gmail.com> - 2013-06-12 12:05 +1000
              Re: A certainl part of an if() structure never gets executed. alex23 <wuwei23@gmail.com> - 2013-06-11 19:14 -0700
                Re: A certainl part of an if() structure never gets executed. Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-11 20:37 -0700
                  Re: A certainl part of an if() structure never gets executed. Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-11 20:50 -0700
          Re: A certainl part of an if() structure never gets executed. Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2013-06-26 11:07 +0200
        Re: A certainl part of an if() structure never gets executed. MRAB <python@mrabarnett.plus.com> - 2013-06-12 02:50 +0100
        Re: A certainl part of an if() structure never gets executed. Cameron Simpson <cs@zip.com.au> - 2013-06-12 12:00 +1000
    Re: A certainl part of an if() structure never gets executed. Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-11 15:48 -0700
    Re: A certainl part of an if() structure never gets executed. alex23 <wuwei23@gmail.com> - 2013-06-11 16:45 -0700
    Re: A certainl part of an if() structure never gets executed. Michael Torrie <torriem@gmail.com> - 2013-06-11 22:49 -0600
      Re: A certainl part of an if() structure never gets executed. Νικόλαος Κούρας <support@superhost.gr> - 2013-06-12 07:45 +0000
        Re: A certainl part of an if() structure never gets executed. Chris Angelico <rosuav@gmail.com> - 2013-06-12 17:55 +1000
          Re: A certainl part of an if() structure never gets executed. Neil Cerutti <neilc@norwich.edu> - 2013-06-12 13:05 +0000
            Re: A certainl part of an if() structure never gets executed. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-12 15:37 +0100
    Re: A certainl part of an if() structure never gets executed. Michael Torrie <torriem@gmail.com> - 2013-06-11 23:05 -0600
    Re: A certainl part of an if() structure never gets executed. Tim Roberts <timr@probo.com> - 2013-06-11 22:44 -0700
      Re: A certainl part of an if() structure never gets executed. alex23 <wuwei23@gmail.com> - 2013-06-11 23:16 -0700
      Re: A certainl part of an if() structure never gets executed. Grant Edwards <invalid@invalid.invalid> - 2013-06-12 14:38 +0000
        Re: A certainl part of an if() structure never gets executed. Neil Cerutti <neilc@norwich.edu> - 2013-06-12 14:55 +0000
          Re: A certainl part of an if() structure never gets executed. Zero Piraeus <schesis@gmail.com> - 2013-06-12 11:20 -0400
            Re: A certainl part of an if() structure never gets executed. rusi <rustompmody@gmail.com> - 2013-06-13 05:30 -0700
              Re: A certainl part of an if() structure never gets executed. Roy Smith <roy@panix.com> - 2013-06-13 09:01 -0400
            Re: A certainl part of an if() structure never gets executed. Neil Cerutti <neilc@norwich.edu> - 2013-06-13 12:34 +0000
              Re: A certainl part of an if() structure never gets executed. Νικόλαος Κούρας <support@superhost.gr> - 2013-06-13 20:00 +0300
                Re: A certainl part of an if() structure never gets executed. Jan Riechers <janpeterr@freenet.de> - 2013-06-19 01:05 +0300
    Re: A certainl part of an if() structure never gets executed. Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-12 08:27 +0000
      Re: A certainl part of an if() structure never gets executed. Νικόλαος Κούρας <support@superhost.gr> - 2013-06-12 11:54 +0300
        Re: A certainl part of an if() structure never gets executed. Fábio Santos <fabiosantosart@gmail.com> - 2013-06-12 10:07 +0100
          Re: A certainl part of an if() structure never gets executed. Νικόλαος Κούρας <support@superhost.gr> - 2013-06-12 12:19 +0300
            Re: A certainl part of an if() structure never gets executed. Fábio Santos <fabiosantosart@gmail.com> - 2013-06-12 10:57 +0100
          Re: A certainl part of an if() structure never gets executed. Νικόλαος Κούρας <support@superhost.gr> - 2013-06-12 13:45 +0300
        Re: A certainl part of an if() structure never gets executed. Andreas Perstinger <andipersti@gmail.com> - 2013-06-12 12:07 +0200
          Re: A certainl part of an if() structure never gets executed. Νικόλαος Κούρας <support@superhost.gr> - 2013-06-12 13:59 +0300
          Re: A certainl part of an if() structure never gets executed. Νικόλαος Κούρας <support@superhost.gr> - 2013-06-12 14:03 +0300
            Re: A certainl part of an if() structure never gets executed. Fábio Santos <fabiosantosart@gmail.com> - 2013-06-12 12:49 +0100
              Re: A certainl part of an if() structure never gets executed. Νικόλαος Κούρας <support@superhost.gr> - 2013-06-12 15:39 +0300
          Re: A certainl part of an if() structure never gets executed. feedthetroll@gmx.de - 2013-06-12 04:07 -0700
            Re: A certainl part of an if() structure never gets executed. Chris Angelico <rosuav@gmail.com> - 2013-06-13 06:15 +1000
          Re: A certainl part of an if() structure never gets executed. Νικόλαος Κούρας <support@superhost.gr> - 2013-06-12 14:17 +0300
            Re: A certainl part of an if() structure never gets executed. MRAB <python@mrabarnett.plus.com> - 2013-06-12 17:40 +0100
              Re: A certainl part of an if() structure never gets executed. Νικόλαος Κούρας <support@superhost.gr> - 2013-06-12 20:13 +0300
                Re: A certainl part of an if() structure never gets executed. MRAB <python@mrabarnett.plus.com> - 2013-06-12 18:53 +0100
                  Re: A certainl part of an if() structure never gets executed. Νικόλαος Κούρας <support@superhost.gr> - 2013-06-12 21:06 +0300
                    Re: A certainl part of an if() structure never gets executed. Sibylle Koczian <nulla.epistola@web.de> - 2013-06-12 21:48 +0200
                      Re: A certainl part of an if() structure never gets executed. Νικόλαος Κούρας <support@superhost.gr> - 2013-06-12 23:00 +0300
                        Re: A certainl part of an if() structure never gets executed. Chris Angelico <rosuav@gmail.com> - 2013-06-13 06:16 +1000
                        Re: A certainl part of an if() structure never gets executed. Sibylle Koczian <nulla.epistola@web.de> - 2013-06-12 23:16 +0200
                          Re: A certainl part of an if() structure never gets executed. Νικόλαος Κούρας <support@superhost.gr> - 2013-06-13 17:47 +0300
            Re: A certainl part of an if() structure never gets executed. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-13 01:55 +0000
              Re: A certainl part of an if() structure never gets executed. Chris Angelico <rosuav@gmail.com> - 2013-06-13 12:03 +1000
              Re: A certainl part of an if() structure never gets executed. Kushal Kumaran <kushal.kumaran+python@gmail.com> - 2013-06-13 10:05 +0530
              Re: A certainl part of an if() structure never gets executed. Chris Angelico <rosuav@gmail.com> - 2013-06-13 14:39 +1000
              Re: A certainl part of an if() structure never gets executed. Νικόλαος Κούρας <support@superhost.gr> - 2013-06-13 08:36 +0300
              Re: A certainl part of an if() structure never gets executed. Νικόλαος Κούρας <support@superhost.gr> - 2013-06-13 10:11 +0300
                Re: A certainl part of an if() structure never gets executed. Sibylle Koczian <nulla.epistola@web.de> - 2013-06-13 14:22 +0200
                  Re: A certainl part of an if() structure never gets executed. Νικόλαος Κούρας <support@superhost.gr> - 2013-06-13 17:26 +0300
                    Re: A certainl part of an if() structure never gets executed. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-14 01:14 +0000
                      Re: A certainl part of an if() structure never gets executed. Nick the Gr33k <support@superhost.gr> - 2013-06-14 11:03 +0300
                        Re: A certainl part of an if() structure never gets executed. Chris Angelico <rosuav@gmail.com> - 2013-06-14 18:23 +1000
                        Re: A certainl part of an if() structure never gets executed. "R. Michael Weylandt" <michael.weylandt@gmail.com> - 2013-06-14 09:24 +0100
                        Re: A certainl part of an if() structure never gets executed. Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-06-14 11:28 +0300
                          Re: A certainl part of an if() structure never gets executed. Nick the Gr33k <support@superhost.gr> - 2013-06-14 11:41 +0300
                            Re: A certainl part of an if() structure never gets executed. Chris Angelico <rosuav@gmail.com> - 2013-06-14 18:50 +1000
                            Re: A certainl part of an if() structure never gets executed. Fábio Santos <fabiosantosart@gmail.com> - 2013-06-14 10:03 +0100
                            Re: A certainl part of an if() structure never gets executed. Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-06-14 12:21 +0300
                              Re: A certainl part of an if() structure never gets executed. Nick the Gr33k <support@superhost.gr> - 2013-06-14 12:44 +0300
                                Re: A certainl part of an if() structure never gets executed. Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-06-14 15:40 +0300
                                  Re: A certainl part of an if() structure never gets executed. Nick the Gr33k <support@superhost.gr> - 2013-06-14 16:07 +0300
                                    Re: A certainl part of an if() structure never gets executed. Zero Piraeus <schesis@gmail.com> - 2013-06-14 09:48 -0400
                                      Re: A certainl part of an if() structure never gets executed. rusi <rustompmody@gmail.com> - 2013-06-14 07:05 -0700
                                      Re: A certainl part of an if() structure never gets executed. Nick the Gr33k <support@superhost.gr> - 2013-06-14 17:08 +0300
                                    Re: A certainl part of an if() structure never gets executed. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-14 16:31 +0000
                                      Re: A certainl part of an if() structure never gets executed. Nick the Gr33k <support@superhost.gr> - 2013-06-14 19:56 +0300
                                        Re: A certainl part of an if() structure never gets executed. Chris Angelico <rosuav@gmail.com> - 2013-06-15 03:18 +1000
                                        Re: A certainl part of an if() structure never gets executed. Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-06-14 21:17 +0300
                                        Re: A certainl part of an if() structure never gets executed. Larry Hudson <orgnut@yahoo.com> - 2013-06-14 22:27 -0700
                                          Re: A certainl part of an if() structure never gets executed. Nick the Gr33k <support@superhost.gr> - 2013-06-15 11:39 +0300
                                            Re: A certainl part of an if() structure never gets executed. Lele Gaifax <lele@metapensiero.it> - 2013-06-15 11:54 +0200
                                              Re: A certainl part of an if() structure never gets executed. Nick the Gr33k <support@superhost.gr> - 2013-06-15 16:07 +0300
                                                Re: A certainl part of an if() structure never gets executed. Michael Torrie <torriem@gmail.com> - 2013-06-15 09:53 -0600
                                                  Re: A certainl part of an if() structure never gets executed. Nick the Gr33k <support@superhost.gr> - 2013-06-15 19:18 +0300
                                                    Re: A certainl part of an if() structure never gets executed. Michael Torrie <torriem@gmail.com> - 2013-06-15 11:45 -0600
                                                    Re: A certainl part of an if() structure never gets executed. Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-16 06:32 +0000
                                                      Re: A certainl part of an if() structure never gets executed. Nick the Gr33k <support@superhost.gr> - 2013-06-16 11:07 +0300
                                                        Re: A certainl part of an if() structure never gets executed. Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-16 09:22 +0000
                                                          Re: A certainl part of an if() structure never gets executed. Nick the Gr33k <support@superhost.gr> - 2013-06-16 12:59 +0300
                                                            Re: A certainl part of an if() structure never gets executed. "R. Michael Weylandt" <michael.weylandt@gmail.com> - 2013-06-16 11:42 +0100
                                                              Re: A certainl part of an if() structure never gets executed. Ferrous Cranus <support@superhost.gr> - 2013-06-16 14:06 +0300
                                                                Re: A certainl part of an if() structure never gets executed. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-16 12:26 +0100
                                                                Re: A certainl part of an if() structure never gets executed. YBM <ybmess@nooos.fr.invalid> - 2013-06-16 14:00 +0200
                                                                Re: A certainl part of an if() structure never gets executed. "R. Michael Weylandt" <michael.weylandt@gmail.com> - 2013-06-16 13:04 +0100
                                                                  Re: A certainl part of an if() structure never gets executed. Ferrous Cranus <support@superhost.gr> - 2013-06-16 16:38 +0300
                                                                    Re: A certainl part of an if() structure never gets executed. "R. Michael Weylandt" <michael.weylandt@gmail.com> - 2013-06-16 19:50 +0100
                                                            Re: A certainl part of an if() structure never gets executed. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-16 11:52 +0100
                                                            Re: A certainl part of an if() structure never gets executed. Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-16 10:51 +0000
                                                              Compiling vs interpreting [was Re: A certainl part of an if() structure never gets executed.] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-16 12:07 +0000
                                                                Re: Compiling vs interpreting [was Re: A certainl part of an if() structure never gets executed.] Mark Janssen <dreamingforward@gmail.com> - 2013-06-16 12:31 -0700
                                                                  Re: Compiling vs interpreting [was Re: A certainl part of an if() structure never gets executed.] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-16 20:02 +0000
                                                                    Re: Compiling vs interpreting [was Re: A certainl part of an if() structure never gets executed.] Chris Angelico <rosuav@gmail.com> - 2013-06-17 08:26 +1000
                                                                Re: Compiling vs interpreting [was Re: A certainl part of an if() structure never gets executed.] Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-06-16 23:13 -0400
                                                            Re: A certainl part of an if() structure never gets executed. Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-06-16 14:13 +0300
                                                              Re: A certainl part of an if() structure never gets executed. Ferrous Cranus <support@superhost.gr> - 2013-06-16 16:47 +0300
                                                                Re: A certainl part of an if() structure never gets executed. "R. Michael Weylandt" <michael.weylandt@gmail.com> - 2013-06-16 19:53 +0100
                                                                  Re: A certainl part of an if() structure never gets executed. Νίκος <support@superhost.gr> - 2013-06-17 08:17 +0300
                                                                    Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-17 06:51 +0000
                                                                      Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Simpleton <support@superhost.gr> - 2013-06-17 14:34 +0300
                                                                        Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Michael Torrie <torriem@gmail.com> - 2013-06-17 05:58 -0600
                                                                          Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Simpleton <support@superhost.gr> - 2013-06-17 18:50 +0300
                                                                            Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Larry Hudson <orgnut@yahoo.com> - 2013-06-17 23:39 -0700
                                                                              Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-18 07:24 +0000
                                                                              Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Νίκος <support@superhost.gr> - 2013-06-18 11:49 +0300
                                                                                Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-18 09:05 +0000
                                                                                  Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Νίκος <support@superhost.gr> - 2013-06-18 12:51 +0300
                                                                                    Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Chris Angelico <rosuav@gmail.com> - 2013-06-18 20:22 +1000
                                                                                    Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Michael Torrie <torriem@gmail.com> - 2013-06-19 23:16 -0600
                                                                                      Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-20 05:48 +0000
                                                                                        Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Michael Torrie <torriem@gmail.com> - 2013-06-20 00:01 -0600
                                                                                          Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] 88888 Dihedral <dihedral88888@gmail.com> - 2013-06-26 01:18 -0700
                                                                                    Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Michael Torrie <torriem@gmail.com> - 2013-06-19 23:44 -0600
                                                                                    Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Roel Schroeven <roel@roelschroeven.net> - 2013-06-20 19:19 +0200
                                                                        Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Terry Reedy <tjreedy@udel.edu> - 2013-06-17 10:22 -0400
                                                                          Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Simpleton <support@superhost.gr> - 2013-06-17 18:55 +0300
                                                                            Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Joel Goldstick <joel.goldstick@gmail.com> - 2013-06-17 12:26 -0400
                                                                            Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Benjamin Kaplan <benjamin.kaplan@case.edu> - 2013-06-17 09:23 -0700
                                                                              Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Νίκος <support@superhost.gr> - 2013-06-17 20:17 +0300
                                                                                Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Terry Reedy <tjreedy@udel.edu> - 2013-06-17 18:16 -0400
                                                                        Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-17 23:09 +0000
                                                                          Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Νίκος <support@superhost.gr> - 2013-06-18 02:26 +0300
                                                                            Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-18 00:41 +0000
                                                                              Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Dave Angel <davea@davea.name> - 2013-06-17 21:06 -0400
                                                                                Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-18 02:42 +0000
                                                                                  Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Dave Angel <davea@davea.name> - 2013-06-18 00:12 -0400
                                                                                    Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-18 06:04 +0000
                                                                              Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-18 02:38 +0000
                                                                                Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-18 02:46 +0000
                                                                            Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-06-17 21:34 -0400
                                                                            Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] Marcin Szamotulski <mszamot@gmail.com> - 2013-06-18 04:22 +0100
                                                                    Re: A certainl part of an if() structure never gets executed. Michael Weylandt <michael.weylandt@gmail.com> - 2013-06-17 07:56 +0100
                                                          Re: A certainl part of an if() structure never gets executed. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-16 12:50 +0000
                                                      OT: C vs Python terminology (was: A certainl part of an if() structure never gets executed) Andreas Perstinger <andipersti@gmail.com> - 2013-06-16 13:22 +0200
                                                      Re: OT: C vs Python terminology Dave Angel <davea@davea.name> - 2013-06-16 08:55 -0400
                                                      Re: OT: C vs Python terminology Andreas Perstinger <andipersti@gmail.com> - 2013-06-16 17:02 +0200
                                                      Re: OT: C vs Python terminology Dave Angel <davea@davea.name> - 2013-06-16 21:58 -0400
                        Re: A certainl part of an if() structure never gets executed. "R. Michael Weylandt" <michael.weylandt@gmail.com> - 2013-06-14 09:28 +0100
                        Re: A certainl part of an if() structure never gets executed. Fábio Santos <fabiosantosart@gmail.com> - 2013-06-14 09:35 +0100
                        Re: A certainl part of an if() structure never gets executed. Nick the Gr33k <support@superhost.gr> - 2013-06-14 11:44 +0300
                          Re: A certainl part of an if() structure never gets executed. Chris Angelico <rosuav@gmail.com> - 2013-06-14 18:57 +1000
                            Re: A certainl part of an if() structure never gets executed. Nick the Gr33k <support@superhost.gr> - 2013-06-14 12:00 +0300
                              Re: A certainl part of an if() structure never gets executed. Chris Angelico <rosuav@gmail.com> - 2013-06-14 19:12 +1000
                                Re: A certainl part of an if() structure never gets executed. Nick the Gr33k <support@superhost.gr> - 2013-06-14 12:47 +0300
                                  Re: A certainl part of an if() structure never gets executed. Tim Roberts <timr@probo.com> - 2013-06-15 18:55 -0700
                                    Re: A certainl part of an if() structure never gets executed. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-16 05:09 +0000
                                    Re: A certainl part of an if() structure never gets executed. Nick the Gr33k <support@superhost.gr> - 2013-06-16 11:20 +0300
                                      Re: A certainl part of an if() structure never gets executed. Tim Roberts <timr@probo.com> - 2013-06-18 22:08 -0700
                                        Re: A certainl part of an if() structure never gets executed. Dave Angel <davea@davea.name> - 2013-06-19 01:42 -0400
                                        Re: A certainl part of an if() structure never gets executed. Chris Angelico <rosuav@gmail.com> - 2013-06-19 17:14 +1000
                                        Re: A certainl part of an if() structure never gets executed. Νίκος <support@superhost.gr> - 2013-06-19 10:49 +0300
                                        Re: A certainl part of an if() structure never gets executed. Dave Angel <davea@davea.name> - 2013-06-19 04:06 -0400
                                        Re: A certainl part of an if() structure never gets executed. Chris Angelico <rosuav@gmail.com> - 2013-06-19 18:21 +1000
                                          Re: A certainl part of an if() structure never gets executed. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-19 08:55 +0000
                                            Re: A certainl part of an if() structure never gets executed. Chris Angelico <rosuav@gmail.com> - 2013-06-19 19:14 +1000
                              Re: A certainl part of an if() structure never gets executed. Grant Edwards <invalid@invalid.invalid> - 2013-06-14 14:38 +0000
                          Re: A certainl part of an if() structure never gets executed. Fábio Santos <fabiosantosart@gmail.com> - 2013-06-14 10:05 +0100
        Re: A certainl part of an if() structure never gets executed. Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-14 12:03 +0000
          Re: A certainl part of an if() structure never gets executed. Nick the Gr33k <support@superhost.gr> - 2013-06-14 15:31 +0300

Page 4 of 9 — ← Prev page 1 2 3 [4] 5 6 7 8 9  Next page →


#47945

FromSibylle Koczian <nulla.epistola@web.de>
Date2013-06-13 14:22 +0200
Message-ID<mailman.3184.1371126194.3114.python-list@python.org>
In reply to#47913
Am 13.06.2013 09:11, schrieb Νικόλαος Κούρας:
> On 13/6/2013 4:55 πμ, Steven D'Aprano wrote:
>>
>> The "and" operator works in a similar fashion. Experiment with it and see
>> how it works for yourself.
>
> I read yours psots many times,all of them, tryign to understand them.
>

But you didn't do what he recommended, did you? And it's really the best 
or possibly the only way to understanding.

Try it out in the interactive Shell, using Stevens examples connected 
with 'and' instead of 'or'.

Sibylle



[toc] | [prev] | [next] | [standalone]


#47969

FromΝικόλαος Κούρας <support@superhost.gr>
Date2013-06-13 17:26 +0300
Message-ID<kpckqb$28k2$3@news.ntua.gr>
In reply to#47945
On 13/6/2013 3:22 μμ, Sibylle Koczian wrote:
> Am 13.06.2013 09:11, schrieb Νικόλαος Κούρας:
>> On 13/6/2013 4:55 πμ, Steven D'Aprano wrote:
>>>
>>> The "and" operator works in a similar fashion. Experiment with it and
>>> see
>>> how it works for yourself.
>>
>> I read yours psots many times,all of them, tryign to understand them.
>>
>
> But you didn't do what he recommended, did you? And it's really the best
> or possibly the only way to understanding.
>
> Try it out in the interactive Shell, using Stevens examples connected
> with 'and' instead of 'or'.

I try and try to work it out but i can't understand it even in theory.

==================

         if '-' not in ( name and month and year ):
             cur.execute( '''SELECT * FROM works WHERE clientsID = 
(SELECT id FROM clients WHERE name = %s) and MONTH(lastvisit) = %s and 
YEAR(lastvisit) = %s ORDER BY lastvisit ASC''', (name, month, year) )
         elif '-' not in ( name and year ):
             cur.execute( '''SELECT * FROM works WHERE clientsID = 
(SELECT id FROM clients WHERE name = %s) and YEAR(lastvisit) = %s ORDER 
BY lastvisit ASC''', (name, year) )
         elif '-' not in ( month and year ):
             cur.execute( '''SELECT * FROM works WHERE MONTH(lastvisit) 
= %s and YEAR(lastvisit) = %s ORDER BY lastvisit ASC''', (month, year) )
         elif '-' not in year:
             cur.execute( '''SELECT * FROM works WHERE YEAR(lastvisit) = 
%s ORDER BY lastvisit ASC''', year )

======================

i just want 4 cases to examine so correct execute to be run:

i'm reading and reading and reading this all over:

if '-' not in ( name and month and year ):

and i cant comprehend it.

While it seems so beautiful saying:

if character '-' ain't contained in string name , neither in string 
month neither in string year.

But it just doesn't work like this.

Since  ( name and month and year ) are all truthy values, what is 
returned by this expression to be checked if it cotnains '=' within it?


[toc] | [prev] | [next] | [standalone]


#48046

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-06-14 01:14 +0000
Message-ID<51ba6e92$0$29997$c3e8da3$5496439d@news.astraweb.com>
In reply to#47969
On Thu, 13 Jun 2013 17:26:18 +0300, Νικόλαος Κούρας wrote:

> i just want 4 cases to examine so correct execute to be run:
> 
> i'm reading and reading and reading this all over:
> 
> if '-' not in ( name and month and year ):
> 
> and i cant comprehend it.

Don't just read it. Open the interactive interpreter and test it.

name = "abcd"
month = "efgh"
year = "ijkl"

print(name and month and year)

If you run that, you will see what the result of 
(name and month and year) is. Now, ask yourself:

"k" in (name and month and year)

True or false? Check your answer:

print("k" in (name and month and year))



> While it seems so beautiful saying:
> 
> if character '-' ain't contained in string name , neither in string
> month neither in string year.
> 
> But it just doesn't work like this.

Correct. It doesn't work that way.

> Since  ( name and month and year ) are all truthy values, what is
> returned by this expression to be checked if it cotnains '=' within it?

Stop asking these questions. Try it for yourself and learn for yourself. 
You have a Python interactive interpreter. Try things, and see what they 
do. Read the documentation. THEN, and ONLY after you have done these 
things, should you ask for help.


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#48077

FromNick the Gr33k <support@superhost.gr>
Date2013-06-14 11:03 +0300
Message-ID<kpeio7$p37$7@news.ntua.gr>
In reply to#48046
On 14/6/2013 4:14 πμ, Steven D'Aprano wrote:
> On Thu, 13 Jun 2013 17:26:18 +0300, Νικόλαος Κούρας wrote:
>
>> i just want 4 cases to examine so correct execute to be run:
>>
>> i'm reading and reading and reading this all over:
>>
>> if '-' not in ( name and month and year ):
>>
>> and i cant comprehend it.
>
> Don't just read it. Open the interactive interpreter and test it.
>
> name = "abcd"
> month = "efgh"
> year = "ijkl"
>
> print(name and month and year)
>
> If you run that, you will see what the result of
> (name and month and year) is. Now, ask yourself:
>
> "k" in (name and month and year)
>
> True or false? Check your answer:
>
> print("k" in (name and month and year))


 >>> name="abcd"
 >>> month="efgh"
 >>> year="ijkl"

 >>> print(name or month or year)
abcd

Can understand that, it takes the first string out of the 3 strings that 
has a truthy value.

 >>> print("k" in (name and month and year))
True

No clue. since the expression in parenthesis returns 'abcd' how can 'k' 
contained within 'abcd' ?

 >>> print(name and month and year)
ijkl

Seems here is returning the last string out of 3 strings, but have no 
clue why Python doing this.

 >>> print("k" in (name and month and year))
True
 >>>

yes, since expression returns 'ijkl', then the in operator can detect 
the 'k' character within the returned string.

-- 
What is now proved was at first only imagined!

[toc] | [prev] | [next] | [standalone]


#48083

FromChris Angelico <rosuav@gmail.com>
Date2013-06-14 18:23 +1000
Message-ID<mailman.3267.1371198232.3114.python-list@python.org>
In reply to#48077
On Fri, Jun 14, 2013 at 6:03 PM, Nick the Gr33k <support@superhost.gr> wrote:
>>>> print(name or month or year)
>>>> print("k" in (name and month and year))

Seriously, you can't see the difference between those lines? Either
you're trolling - which is still a distinct possibility, but so is the
converse - or there's something between here and the northern
hemisphere that makes the obvious unobvious and vice versa. Or maybe
I'm actually living in Alice's Wonderland and nothing here makes
sense...

ChrisA

[toc] | [prev] | [next] | [standalone]


#48084

From"R. Michael Weylandt" <michael.weylandt@gmail.com>
Date2013-06-14 09:24 +0100
Message-ID<mailman.3268.1371198287.3114.python-list@python.org>
In reply to#48077
On Fri, Jun 14, 2013 at 9:03 AM, Nick the Gr33k <support@superhost.gr> wrote:>
>>>> name="abcd"
>>>> month="efgh"
>>>> year="ijkl"
>
>>>> print(name or month or year)
> abcd
>
> Can understand that, it takes the first string out of the 3 strings that has
> a truthy value.
>
>>>> print("k" in (name and month and year))
> True
>
> No clue. since the expression in parenthesis returns 'abcd' how can 'k'
> contained within 'abcd' ?

No it's not. See both above (where you use 'or' instead) and below
where _you yourself_ show that it's not 'abcd.'

Now read: https://en.wikipedia.org/wiki/Short-circuit_evaluation
noting especially the specified behavior for Python. If you find it
too technical, google for other uses of the terms.

>
>>>> print(name and month and year)
> ijkl
>
> Seems here is returning the last string out of 3 strings, but have no clue
> why Python doing this.

Think about basic logic: 'or' means 'is at least one true?' so Python
only has to look at the first 'truthy value'. 'and' means 'are they
all true?' so Python has to look at all the values, ending up with the
last one, unless a 'falsey value' is found before.

Michael

[toc] | [prev] | [next] | [standalone]


#48085

FromJussi Piitulainen <jpiitula@ling.helsinki.fi>
Date2013-06-14 11:28 +0300
Message-ID<qot1u85gkpq.fsf@ruuvi.it.helsinki.fi>
In reply to#48077
Nick the Gr33k writes:

>  >>> name="abcd"
>  >>> month="efgh"
>  >>> year="ijkl"
> 
>  >>> print(name or month or year)
> abcd
> 
> Can understand that, it takes the first string out of the 3 strings
> that has a truthy value.
> 
>  >>> print("k" in (name and month and year))
> True
> 
> No clue. since the expression in parenthesis returns 'abcd' how can
> 'k' contained within 'abcd' ?

Why shouldn't (name or month or year) be different from (name and
month and year)?

Incidentally, you get better information without the print():

>>> 'Parker' and 'May' and '2001'
'2001'
>>> 

>>> 'Parker' and 'May' and 2001
2001
>>> 

Either way, the interactive prompt is your friend.

[toc] | [prev] | [next] | [standalone]


#48089

FromNick the Gr33k <support@superhost.gr>
Date2013-06-14 11:41 +0300
Message-ID<kpel04$spl$2@news.ntua.gr>
In reply to#48085
On 14/6/2013 11:28 πμ, Jussi Piitulainen wrote:

>>>> 'Parker' and 'May' and '2001'
> '2001'

But why?

that expression should return True since all stings are not empty.

> Either way, the interactive prompt is your friend.
>


-- 
What is now proved was at first only imagined!

[toc] | [prev] | [next] | [standalone]


#48092

FromChris Angelico <rosuav@gmail.com>
Date2013-06-14 18:50 +1000
Message-ID<mailman.3272.1371199807.3114.python-list@python.org>
In reply to#48089
On Fri, Jun 14, 2013 at 6:41 PM, Nick the Gr33k <support@superhost.gr> wrote:
> On 14/6/2013 11:28 πμ, Jussi Piitulainen wrote:
>
>>>>> 'Parker' and 'May' and '2001'
>>
>> '2001'
>
>
> But why?
>
> that expression should return True since all stings are not empty.

It does. Not the bool value, but it does return a true value.

ChrisA

[toc] | [prev] | [next] | [standalone]


#48095

FromFábio Santos <fabiosantosart@gmail.com>
Date2013-06-14 10:03 +0100
Message-ID<mailman.3274.1371200607.3114.python-list@python.org>
In reply to#48089

[Multipart message — attachments visible in raw view] — view raw

On 14 Jun 2013 09:51, "Nick the Gr33k" <support@superhost.gr> wrote:
>
> On 14/6/2013 11:28 πμ, Jussi Piitulainen wrote:
>
>>>>> 'Parker' and 'May' and '2001'
>>
>> '2001'
>
>
> But why?
>
> that expression should return True since all stings are not empty.
>
>
>> Either way, the interactive prompt is your friend.
>>
>

At the very least read the replies to your questions.
http://code.activestate.com/lists/python-list/644572/

[toc] | [prev] | [next] | [standalone]


#48100

FromJussi Piitulainen <jpiitula@ling.helsinki.fi>
Date2013-06-14 12:21 +0300
Message-ID<qotobb9f3oy.fsf@ruuvi.it.helsinki.fi>
In reply to#48089
Nick the Gr33k writes:

> On 14/6/2013 11:28 πμ, Jussi Piitulainen wrote:
> 
> >>>> 'Parker' and 'May' and '2001'
> > '2001'
> 
> But why?
> 
> that expression should return True since all stings are not empty.

It returns a value that counts as true in a conditional statement or
expression:

>>> if '2001': print('got a truish value')
... else: print("didn't")
... 
got a truish value

>>> if '': print('got a truish value')
... else: print("didn't")
... 
didn't

Zeroes and empty things tend to count as false in Python, other values
as true. The values are tested as is, not coerced to a boolean first,
so the value that decides the value of the whole expression is the
value of the whole expression.

>>> '' and whatever
''
>>> False and whatever
False
>>> 0 and whatever
0
>>> 1 and whatever
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: name 'whatever' is not defined

[toc] | [prev] | [next] | [standalone]


#48104

FromNick the Gr33k <support@superhost.gr>
Date2013-06-14 12:44 +0300
Message-ID<kpeomq$spl$6@news.ntua.gr>
In reply to#48100
On 14/6/2013 12:21 μμ, Jussi Piitulainen wrote:
> Nick the Gr33k writes:
>
>> On 14/6/2013 11:28 πμ, Jussi Piitulainen wrote:
>>
>>>>>> 'Parker' and 'May' and '2001'
>>> '2001'
>>
>> But why?
>>
>> that expression should return True since all stings are not empty.
>
> It returns a value that counts as true in a conditional statement or
> expression:

When a look at ('Parker' and 'May' and '2001') i can't help it but 
interpret it as:

Return True if  'Parker' is not an empty string AND 'May' is not an 
empty string AND'2001'  is not an empty string.

Why on eart doesn't work this way?

I can understand that the value it results to '2000' is a truthy value, 
although i was expecting it to result in True if all parts of 
expressions are true.

i just don't understand why it returns back the last value instead.

> Zeroes and empty things tend to count as false in Python, other values
> as true. The values are tested as is, not coerced to a boolean first,
> so the value that decides the value of the whole expression is the
> value of the whole expression.
>
>>>> '' and whatever
> ''

Why does it return th first object back
isn't it like saying False and True and resulting in False?

Please put it in else word how Python unerstand that.
>>>> False and whatever
> False

Same here? The 2nd part of the expression never is been calculated 
because the 1st is False?
>>>> 0 and whatever
> 0

Same here? The 2nd part of the expression never is been calculated 
because the 1st is False?
>>>> 1 and whatever
> Traceback (most recent call last):
>    File "<stdin>", line 1, in ?
> NameError: name 'whatever' is not defined
>


-- 
What is now proved was at first only imagined!

[toc] | [prev] | [next] | [standalone]


#48132

FromJussi Piitulainen <jpiitula@ling.helsinki.fi>
Date2013-06-14 15:40 +0300
Message-ID<qotmwqsq31b.fsf@ruuvi.it.helsinki.fi>
In reply to#48104
Nick the Gr33k writes:
> On 14/6/2013 12:21 μμ, Jussi Piitulainen wrote:
> > Nick the Gr33k writes:
> >> On 14/6/2013 11:28 πμ, Jussi Piitulainen wrote:
> >>
> >>>>>> 'Parker' and 'May' and '2001'
> >>> '2001'
> >>
> >> But why?
> >>
> >> that expression should return True since all stings are not empty.
> >
> > It returns a value that counts as true in a conditional statement or
> > expression:
> 
> When a look at ('Parker' and 'May' and '2001') i can't help it but
> interpret it as:
> 
> Return True if  'Parker' is not an empty string AND 'May' is not an
> empty string AND'2001'  is not an empty string.

Nah. That expression would be:

  True if ('Parker' != '' and 'May' != '' and '2001' != '') else False

The one at hand is more like: 'Parker' if 'Parker' does not count as
true, else 'May' if 'May' does not count as true, else '2001' (which
counts as true if it counts as true, else it counts as false ...).

> i just don't understand why it returns back the last value instead.

I suppose the value can be useful, and there is generally no harm in
it. But why not adjust your expectations to the reality? You can still
ask why.

This behaviour of the /and/ and /or/ was used to simulate the
conditional expression (_ if _ else _) before the latter was in the
language.

> >>>> '' and whatever
> > ''
> 
> Why does it return th first object back
> isn't it like saying False and True and resulting in False?
> 
> Please put it in else word how Python unerstand that.

That would be: '' if '' counts as false, else whatever.

And yes, when the first expression determines the value, the second
expression is not evaluated. /or/ is similar.

[toc] | [prev] | [next] | [standalone]


#48143

FromNick the Gr33k <support@superhost.gr>
Date2013-06-14 16:07 +0300
Message-ID<kpf4jc$spl$15@news.ntua.gr>
In reply to#48132
On 14/6/2013 3:40 μμ, Jussi Piitulainen wrote:
> Nick the Gr33k writes:
>> On 14/6/2013 12:21 μμ, Jussi Piitulainen wrote:
>>> Nick the Gr33k writes:
>>>> On 14/6/2013 11:28 πμ, Jussi Piitulainen wrote:
>>>>
>>>>>>>> 'Parker' and 'May' and '2001'
>>>>> '2001'
>>>>
>>>> But why?
>>>>
>>>> that expression should return True since all stings are not empty.
>>>
>>> It returns a value that counts as true in a conditional statement or
>>> expression:
>>
>> When a look at ('Parker' and 'May' and '2001') i can't help it but
>> interpret it as:
>>
>> Return True if  'Parker' is not an empty string AND 'May' is not an
>> empty string AND'2001'  is not an empty string.
>
> Nah. That expression would be:
>
>    True if ('Parker' != '' and 'May' != '' and '2001' != '') else False
>
> The one at hand is more like: 'Parker' if 'Parker' does not count as
> true, else 'May' if 'May' does not count as true, else '2001' (which
> counts as true if it counts as true, else it counts as false ...).
>
>> i just don't understand why it returns back the last value instead.
>
> I suppose the value can be useful, and there is generally no harm in
> it. But why not adjust your expectations to the reality? You can still
> ask why.
>
> This behaviour of the /and/ and /or/ was used to simulate the
> conditional expression (_ if _ else _) before the latter was in the
> language.
>
>>>>>> '' and whatever
>>> ''
>>
>> Why does it return th first object back
>> isn't it like saying False and True and resulting in False?
>>
>> Please put it in else word how Python unerstand that.
>
> That would be: '' if '' counts as false, else whatever.
>
> And yes, when the first expression determines the value, the second
> expression is not evaluated. /or/ is similar.
>

Thanks for explaining this but i cannot follow its logic at all.
My mind is stuck trying to interpret it as an English sentence:

if ('Parker' and 'May' and '2001')

if ('Parker' or 'May' or '2001')

i just don't get it and i feel silly about it.

-- 
What is now proved was at first only imagined!

[toc] | [prev] | [next] | [standalone]


#48146

FromZero Piraeus <schesis@gmail.com>
Date2013-06-14 09:48 -0400
Message-ID<mailman.3307.1371217712.3114.python-list@python.org>
In reply to#48143
:

On 14 June 2013 09:07, Nick the Gr33k <support@superhost.gr> wrote:
>
> Thanks for explaining this but i cannot follow its logic at all.
> My mind is stuck trying to interpret it as an English sentence:
>
> if ('Parker' and 'May' and '2001')
>
> if ('Parker' or 'May' or '2001')
>
> i just don't get it and i feel silly about it.

You've been advised many times to experiment in the Python
interpreter. I may be mistaken, but I don't recall seeing any evidence
at all that you've ever done so.

Try the following in a Python interpreter:

>>> "vic" and "bob"
>>> "bob" and "vic"
>>> "vic" or "bob"
>>> "bob" or "vic"
>>> "vic" and ""
>>> "" and "bob"
>>> "bob" or ""
>>> "" or "vic"

Carefully study the results you get. This is simple, basic stuff;
don't come back here asking for explanations of it. If you get stuck,
*carefully* read this article:

  http://en.wikipedia.org/wiki/Short-circuit_evaluation

Repeat the steps above until you do understand. If all else fails,
google "short circuit logic" or "short circuit evaluation python" or
similar search terms, until you find a resource which you do follow.

 -[]z.

[toc] | [prev] | [next] | [standalone]


#48152

Fromrusi <rustompmody@gmail.com>
Date2013-06-14 07:05 -0700
Message-ID<b5761aac-71fc-496d-bf88-42e77956e6e7@rh15g2000pbb.googlegroups.com>
In reply to#48146
On Jun 14, 6:48 pm, Zero Piraeus <sche...@gmail.com> wrote:
> :
>
> On 14 June 2013 09:07, Nick the Gr33k <supp...@superhost.gr> wrote:
>
>
>
> > Thanks for explaining this but i cannot follow its logic at all.
> > My mind is stuck trying to interpret it as an English sentence:
>
> > if ('Parker' and 'May' and '2001')
>
> > if ('Parker' or 'May' or '2001')
>
> > i just don't get it and i feel silly about it.
>
> You've been advised many times to experiment in the Python
> interpreter. I may be mistaken, but I don't recall seeing any evidence
> at all that you've ever done so.
>
> Try the following in a Python interpreter:
>
> >>> "vic" and "bob"
> >>> "bob" and "vic"
> >>> "vic" or "bob"
> >>> "bob" or "vic"
> >>> "vic" and ""
> >>> "" and "bob"
> >>> "bob" or ""
> >>> "" or "vic"
>
> Carefully study the results you get. This is simple, basic stuff;
> don't come back here asking for explanations of it. If you get stuck,
> *carefully* read this article:
>
>  http://en.wikipedia.org/wiki/Short-circuit_evaluation
>
> Repeat the steps above until you do understand. If all else fails,
> google "short circuit logic" or "short circuit evaluation python" or
> similar search terms, until you find a resource which you do follow.
>
>  -[]z.

You get my prize 'Zero' for best answer!

[You've also given me a nice example for my next python class -- I
usually spend time showing how to play in the interpreter.  And the
examples I usually give are numeric/string/list based. Short-circuit
evaluation is good to show. So thanks]

Incidentally, you have also proved right Nicolas' claim that this is
helpful to all :-)  All that is needed is that other charitable-to-
Nick souls on this list should exercise some restraint and provide the
answers that they *know* he *needs* rather than what he *claims* to
*want*.

[toc] | [prev] | [next] | [standalone]


#48153

FromNick the Gr33k <support@superhost.gr>
Date2013-06-14 17:08 +0300
Message-ID<kpf84l$spl$17@news.ntua.gr>
In reply to#48146
On 14/6/2013 4:48 μμ, Zero Piraeus wrote:
> :
>
> On 14 June 2013 09:07, Nick the Gr33k <support@superhost.gr> wrote:
>>
>> Thanks for explaining this but i cannot follow its logic at all.
>> My mind is stuck trying to interpret it as an English sentence:
>>
>> if ('Parker' and 'May' and '2001')
>>
>> if ('Parker' or 'May' or '2001')
>>
>> i just don't get it and i feel silly about it.
>
> You've been advised many times to experiment in the Python
> interpreter. I may be mistaken, but I don't recall seeing any evidence
> at all that you've ever done so.
>
> Try the following in a Python interpreter:
>
>>>> "vic" and "bob"
>>>> "bob" and "vic"
>>>> "vic" or "bob"
>>>> "bob" or "vic"
>>>> "vic" and ""
>>>> "" and "bob"
>>>> "bob" or ""
>>>> "" or "vic"
>
> Carefully study the results you get. This is simple, basic stuff;
> don't come back here asking for explanations of it. If you get stuck,
> *carefully* read this article:
>
>    http://en.wikipedia.org/wiki/Short-circuit_evaluation
>
> Repeat the steps above until you do understand. If all else fails,
> google "short circuit logic" or "short circuit evaluation python" or
> similar search terms, until you find a resource which you do follow.
>
>   -[]z.
>
(a or b or c)

is like saying True or True or True.
the first of these 3 variables that hasn;t as value an emptry string, 
which means they contain a truthy value, that variable's value will be 
returned

For 'and' operator, i do not understand it at all.

-- 
What is now proved was at first only imagined!

[toc] | [prev] | [next] | [standalone]


#48177

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-06-14 16:31 +0000
Message-ID<51bb454c$0$29997$c3e8da3$5496439d@news.astraweb.com>
In reply to#48143
On Fri, 14 Jun 2013 16:07:56 +0300, Nick the Gr33k wrote:

> Thanks for explaining this but i cannot follow its logic at all. My mind
> is stuck trying to interpret it as an English sentence:
> 
> if ('Parker' and 'May' and '2001')
> 
> if ('Parker' or 'May' or '2001')
> 
> i just don't get it and i feel silly about it.

Python is not English. You just have to accept that, no matter how much 
you wish it worked like English, it does not.

Think of it like this:

"If today is Tuesday AND I finish work early, then I can go to the 
movies."

Unless *both* conditions are true, I cannot go to the movies.


"If today is Tuesday AND I finish work early AND I have more than $16 
spare cash to pay for a ticket, then I can go to the movies."

All three conditions must be true, or I cannot go to the movies.


If today is Monday, I don't need to check whether I finish work early, or 
whether I have spare cash. It is enough to know that today is not 
Tuesday, so I'm not going to the movies.


Python works the same way:

today_is_tuesday = True
finish_work_early = True
spare_cash = 11


if today_is_tuesday and finish_work_early and spare_cash > 16:
    print("Going to the movies")
else:
    print("No movies today.")




-- 
Steven

[toc] | [prev] | [next] | [standalone]


#48182

FromNick the Gr33k <support@superhost.gr>
Date2013-06-14 19:56 +0300
Message-ID<kpfhv1$4rq$2@news.ntua.gr>
In reply to#48177
On 14/6/2013 7:31 μμ, Steven D'Aprano wrote:
> On Fri, 14 Jun 2013 16:07:56 +0300, Nick the Gr33k wrote:
>
>> Thanks for explaining this but i cannot follow its logic at all. My mind
>> is stuck trying to interpret it as an English sentence:
>>
>> if ('Parker' and 'May' and '2001')
>>
>> if ('Parker' or 'May' or '2001')
>>
>> i just don't get it and i feel silly about it.
>
> Python is not English. You just have to accept that, no matter how much
> you wish it worked like English, it does not.
>
> Think of it like this:
>
> "If today is Tuesday AND I finish work early, then I can go to the
> movies."
>
> Unless *both* conditions are true, I cannot go to the movies.
>
>
> "If today is Tuesday AND I finish work early AND I have more than $16
> spare cash to pay for a ticket, then I can go to the movies."
>
> All three conditions must be true, or I cannot go to the movies.
>
>
> If today is Monday, I don't need to check whether I finish work early, or
> whether I have spare cash. It is enough to know that today is not
> Tuesday, so I'm not going to the movies.
>
>
> Python works the same way:
>
> today_is_tuesday = True
> finish_work_early = True
> spare_cash = 11
>
>
> if today_is_tuesday and finish_work_early and spare_cash > 16:
>      print("Going to the movies")
> else:
>      print("No movies today.")
>
It will print the latter since the overall boolean evaluation of the 
expression is False since (spare_cash > 16) = False

That's understandable and works just like an English sentence, but in 
this example it was easy since you assigned the vars values to be either 
True or False.

This is my difficulty.

a = 'abcd'
b = 'efgh'
c = 'ijkl'


 >>> (a or b or c)
'abcd'

This for me, should evaluate to True but instead it has been evaluated 
to the first variable's value, which is a truthy value of course since 
its not an empty string, but shouldn't it return True instead?

Returning True is the same thing as returning a variable's truthy value?


 >>> (a and b and c)
'ijkl'

This in my head should have been evaluated to True also since all 3 
strings hold truthy values

Why on earth this boolean expression evaluates to the value of the last 
variable? This is what can't at all seem to follow.


What i'm trying to say that both these exprs are Boolean Expressions 
therefore should return Boolean values not variable's values, even if 
they are truthy.




-- 
What is now proved was at first only imagined!

[toc] | [prev] | [next] | [standalone]


#48191

FromChris Angelico <rosuav@gmail.com>
Date2013-06-15 03:18 +1000
Message-ID<mailman.3324.1371230285.3114.python-list@python.org>
In reply to#48182
On Sat, Jun 15, 2013 at 2:56 AM, Nick the Gr33k <support@superhost.gr> wrote:
> What i'm trying to say that both these exprs are Boolean Expressions
> therefore should return Boolean values not variable's values, even if they
> are truthy.

Okay, now we get to the nub of the matter.

In some languages, what you say is the case. In C, for instance, 3 ||
4 == 1 (C doesn't have dedicated True and False types, it uses 1 and
0). But there are very few situations where you actually need it to
specifically be the boolean values, and plenty where you can make use
of this additional feature. If you want to demand a bool from Python,
there is a way to do this. Experiment with bool() in the interactive
interpreter.

ChrisA

[toc] | [prev] | [next] | [standalone]


Page 4 of 9 — ← Prev page 1 2 3 [4] 5 6 7 8 9  Next page →

Back to top | Article view | comp.lang.python


csiph-web