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 3 of 9 — ← Prev page 1 2 [3] 4 5 6 7 8 9  Next page →


#47786

FromFábio Santos <fabiosantosart@gmail.com>
Date2013-06-12 12:49 +0100
Message-ID<mailman.3063.1371037750.3114.python-list@python.org>
In reply to#47778

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

On 12 Jun 2013 12:08, "Νικόλαος Κούρας" <support@superhost.gr> wrote:
>
> Oh my God!
>
> i just need to do this:
>
>
> for i, month in enumerate( months ):
>         print('<option value="%s"> %s </option>' % (month, month) )

Usually what goes in <option value="..."> is an ID of something. You should
keep using (i, month) and then do months[id] to get the month string.

Also, tuples aren't traditionally used for this. Normally you'd use a list.

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


#47795

FromΝικόλαος Κούρας <support@superhost.gr>
Date2013-06-12 15:39 +0300
Message-ID<kp9q6r$pp8$1@news.ntua.gr>
In reply to#47786
On 12/6/2013 2:49 μμ, F�bio Santos wrote:
>
> On 12 Jun 2013 12:08, "�������� ������" <support@superhost.gr
> <mailto:support@superhost.gr>> wrote:
>  >
>  > Oh my God!
>  >
>  > i just need to do this:
>  >
>  >
>  > for i, month in enumerate( months ):
>  > � � � � print('<option value="%s"> %s </option>' % (month, month) )
>
> Usually what goes in <option value="..."> is an ID of something. You
> should keep using (i, month) and then do months[id] to get the month string.
>
> Also, tuples aren't traditionally used for this. Normally you'd use a list.
>

You were right, i counter needed to signify the value: I just made it 
work as i wanted to!


print('</select><select name="month">')
for i, month in enumerate( months ):
	print('<option value="%s"> %s </option>' % (i, month) )
if month == '0':
		month = '=========='


....
....


# 
=================================================================================================================
# find & display requested info based on name/month/year criteria
# 
=================================================================================================================
if( seek ):		
	try:
		if '=' not in ( name or month or 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 ( month or 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 )

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


#47779

Fromfeedthetroll@gmx.de
Date2013-06-12 04:07 -0700
Message-ID<96d2e333-0f13-4b50-8aaa-738f72d6aac9@googlegroups.com>
In reply to#47770
Am Mittwoch, 12. Juni 2013 12:07:54 UTC+2 schrieb Andreas Perstinger:
> [Please trim your replies to the relevant parts.]
> On 12.06.2013 10:54, Νικόλαος Κούρας wrote:
> > But when it comes to select '==========' from month instead of
> > '==========' to be submitted a zero gets submitted and i think the
> > problem is the way i'm filling up months into the drop down menu which is:
> 
> > for i, month in enumerate(months):
> >       print('<option value="%s"> %s </option>' % (i, month) )
> >
> > the if case does not execute because of the way it checks for None entry
> > which is: elif '=' not in year:
> > but if enumerate yields 0 instead of '==========' then elif '=' not in
> > year of course fails.
> 
> How often do we need to tell you that you should reread your posts 
> before sending them?
> You start with telling us you have problems with "month" and then show 
> us code regarding "year"
> 
> > So, i must tell:
> >
> > for i, month in enumerate(months):
> >       print('<option value="%s"> %s </option>' % (i, month) )
> >
> > to somehow return '==========' instead of 0 but don't know how.
> 
> As with most of your problems you are barking up the wrong tree.
> Why not use the actual value you get from the form to check whether you 
> have a valid month?
> 
> Do you understand why "0" is submitted instead of "=========="?
> 
To Nikos:
My I elaborate that for you:
Your form contains: <option value="0"> ========== </option>
If you still don't know why you get "0" read:
  http://www.w3schools.com/tags/att_option_value.asp (or something in
  greek about html forms)
(Sorry, I know, you do not read doks, because they describe what the software
DOES and not what you WANT it to DO)

So this is no python problem, it is a html-problem.

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


#47839

FromChris Angelico <rosuav@gmail.com>
Date2013-06-13 06:15 +1000
Message-ID<mailman.3124.1371068127.3114.python-list@python.org>
In reply to#47779
On Wed, Jun 12, 2013 at 9:07 PM,  <feedthetroll@gmx.de> wrote:
> If you still don't know why you get "0" read:
>   http://www.w3schools.com/tags/att_option_value.asp (or something in
>   greek about html forms)
> (Sorry, I know, you do not read doks, because they describe what the software
> DOES and not what you WANT it to DO)
>

Please try to avoid linking to w3schools; it has a number of flaws,
which are distinctly off-topic for this list, but mainly it is
non-authoritative. Equivalent and usually more thorough information
can be found in other places, such as Mozilla's Developer pages:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option

Though he probably won't read it whatever the page is, so this is for
the archives more than anything else.

ChrisA

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


#47782

FromΝικόλαος Κούρας <support@superhost.gr>
Date2013-06-12 14:17 +0300
Message-ID<kp9lcd$9l5$1@news.ntua.gr>
In reply to#47770
> As with most of your problems you are barking up the wrong tree.
> Why not use the actual value you get from the form to check whether you
> have a valid month?
> Do you understand why "0" is submitted instead of "=========="?
>
> Bye, Andreas

I have corrected the enumerate loop but it seems thet now the year works 
and the selected name nad month fail:

		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 ( 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 )
		else:
			print( '<h2><font color=red>Πώς να γίνει αναζήτηση αφού δεν επέλεξες 
ούτε πελάτη ούτε μήνα ή τουλάχιστον το έτος?' )
			print( '<meta http-equiv="REFRESH" 
content="5;/cgi-bin/pelatologio.py">' )
			sys.exit(0)


i tried in , not in and all possible combinations. but somehow it 
confuses me.

doesn't that mean?

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

if '=' does not exists as a char inside the name and month and year 
variables?

i think it does, but why it fails then?

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


#47817

FromMRAB <python@mrabarnett.plus.com>
Date2013-06-12 17:40 +0100
Message-ID<mailman.3113.1371055227.3114.python-list@python.org>
In reply to#47782
On 12/06/2013 12:17, Νικόλαος Κούρας wrote:
>
>> As with most of your problems you are barking up the wrong tree.
>> Why not use the actual value you get from the form to check whether you
>> have a valid month?
>> Do you understand why "0" is submitted instead of "=========="?
>>
>> Bye, Andreas
>
> I have corrected the enumerate loop but it seems thet now the year works
> and the selected name nad month fail:
>
> 		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 ( 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 )
> 		else:
> 			print( '<h2><font color=red>Πώς να γίνει αναζήτηση αφού δεν επέλεξες
> ούτε πελάτη ούτε μήνα ή τουλάχιστον το έτος?' )
> 			print( '<meta http-equiv="REFRESH"
> content="5;/cgi-bin/pelatologio.py">' )
> 			sys.exit(0)
>
>
> i tried in , not in and all possible combinations. but somehow it
> confuses me.
>
> doesn't that mean?
>
> 		if '=' not in ( name and month and year ):
>
> if '=' does not exists as a char inside the name and month and year
> variables?
>
> i think it does, but why it fails then?
>
You think it does, but you're wrong.

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


#47819

FromΝικόλαος Κούρας <support@superhost.gr>
Date2013-06-12 20:13 +0300
Message-ID<kpaa7j$275g$1@news.ntua.gr>
In reply to#47817
On 12/6/2013 7:40 μμ, MRAB wrote:
> On 12/06/2013 12:17, Νικόλαος Κούρας wrote:
>>
>>> As with most of your problems you are barking up the wrong tree.
>>> Why not use the actual value you get from the form to check whether you
>>> have a valid month?
>>> Do you understand why "0" is submitted instead of "=========="?
>>>
>>> Bye, Andreas
>>
>> I have corrected the enumerate loop but it seems thet now the year works
>> and the selected name nad month fail:
>>
>>         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 ( 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 )
>>         else:
>>             print( '<h2><font color=red>Πώς να γίνει αναζήτηση αφού
>> δεν επέλεξες
>> ούτε πελάτη ούτε μήνα ή τουλάχιστον το έτος?' )
>>             print( '<meta http-equiv="REFRESH"
>> content="5;/cgi-bin/pelatologio.py">' )
>>             sys.exit(0)
>>
>>
>> i tried in , not in and all possible combinations. but somehow it
>> confuses me.
>>
>> doesn't that mean?
>>
>>         if '=' not in ( name and month and year ):
>>
>> if '=' does not exists as a char inside the name and month and year
>> variables?
>>
>> i think it does, but why it fails then?
>>
> You think it does, but you're wrong.

How would you telll in english word what this is doing?

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


and then what this is doing?

if '=' not in ( name or month or year ):

Never before i used not in with soe many variables in parenthesi, up 
until now i was specified it as not in var 1 and not in var 2 and not in 
var 2 and so on....

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


#47826

FromMRAB <python@mrabarnett.plus.com>
Date2013-06-12 18:53 +0100
Message-ID<mailman.3116.1371059580.3114.python-list@python.org>
In reply to#47819
On 12/06/2013 18:13, Νικόλαος Κούρας wrote:
> On 12/6/2013 7:40 μμ, MRAB wrote:
>> On 12/06/2013 12:17, Νικόλαος Κούρας wrote:
>>>
>>>> As with most of your problems you are barking up the wrong tree.
>>>> Why not use the actual value you get from the form to check whether you
>>>> have a valid month?
>>>> Do you understand why "0" is submitted instead of "=========="?
>>>>
>>>> Bye, Andreas
>>>
>>> I have corrected the enumerate loop but it seems thet now the year works
>>> and the selected name nad month fail:
>>>
>>>         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 ( 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 )
>>>         else:
>>>             print( '<h2><font color=red>Πώς να γίνει αναζήτηση αφού
>>> δεν επέλεξες
>>> ούτε πελάτη ούτε μήνα ή τουλάχιστον το έτος?' )
>>>             print( '<meta http-equiv="REFRESH"
>>> content="5;/cgi-bin/pelatologio.py">' )
>>>             sys.exit(0)
>>>
>>>
>>> i tried in , not in and all possible combinations. but somehow it
>>> confuses me.
>>>
>>> doesn't that mean?
>>>
>>>         if '=' not in ( name and month and year ):
>>>
>>> if '=' does not exists as a char inside the name and month and year
>>> variables?
>>>
>>> i think it does, but why it fails then?
>>>
>> You think it does, but you're wrong.
>
> How would you telll in english word what this is doing?
>
> if '=' not in ( name and month and year ):
>
In English, the result of:

     x and y

is basically:

     if bool(x) is false then the result is x, otherwise the result is y

For example:

 >>> bool("")
False
 >>> "" and "world"
''
 >>> bool("Hello")
True
 >>> "Hello" and "world"
'world'

>
> and then what this is doing?
>
> if '=' not in ( name or month or year ):
>
In English, the result of:

     x or y

is basically:

     if bool(x) is true then the result is x, otherwise the result is y

For example:

 >>> bool("")
False
 >>> "" or "world"
'world'
 >>> bool("Hello")
True
 >>> "Hello" or "world"
'Hello'

These can be strung together, so that:

     x and y and z

is equivalent to:

     (x and y) and z

and:

     x or y or z

is equivalent to:

     (x or y) or z

and so on, however many times you wish to do it.

> Never before i used not in with soe many variables in parenthesi, up
> until now i was specified it as not in var 1 and not in var 2 and not in
> var 2 and so on....
>
Keep it simple:

     if '=' not in name and '=' not in month and '=' not in year:

There may be a shorter way, but you seem confused enough as it is.

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


#47827

FromΝικόλαος Κούρας <support@superhost.gr>
Date2013-06-12 21:06 +0300
Message-ID<kpadai$275g$7@news.ntua.gr>
In reply to#47826
On 12/6/2013 8:53 μμ, MRAB wrote:

>> and then what this is doing?
>>
>> if '=' not in ( name or month or year ):
>>
> In English, the result of:
>
>      x or y
>
> is basically:
>
>      if bool(x) is true then the result is x, otherwise the result is y
>
> For example:
>
>  >>> bool("")
> False
>  >>> "" or "world"
> 'world'
>  >>> bool("Hello")
> True
>  >>> "Hello" or "world"
> 'Hello'
>
> These can be strung together, so that:
>
>      x and y and z
>
> is equivalent to:
>
>      (x and y) and z
>
> and:
>
>      x or y or z
>
> is equivalent to:
>
>      (x or y) or z
>
> and so on, however many times you wish to do it.
>
>> Never before i used not in with soe many variables in parenthesi, up
>> until now i was specified it as not in var 1 and not in var 2 and not in
>> var 2 and so on....
>>
> Keep it simple:
>
>      if '=' not in name and '=' not in month and '=' not in year:
>
> There may be a shorter way, but you seem confused enough as it is.
>

Whn i see:

if( x and y ):
i understand: if x expression = True AND ALSO y expression = True then 
execute


if( x or y ):
i understand: if x expression = True OR y expression = True then execute


if '=' not in ( name and month and year ):
i understand: if '=' not in name AND '=' not in month AND '=' not in year


if '=' not in ( name or month or year ):
i understand: if '=' not in name OR '=' not in month OR '=' not in year


but i know it does not work like this, but tis is how i understand it. 
its like reading an English sentence

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


#47835

FromSibylle Koczian <nulla.epistola@web.de>
Date2013-06-12 21:48 +0200
Message-ID<mailman.3122.1371066517.3114.python-list@python.org>
In reply to#47827
Am 12.06.2013 20:06, schrieb Νικόλαος Κούρας:
> Whn i see:
>
> if( x and y ):
> i understand: if x expression = True AND ALSO y expression = True then
> execute
>
>
> if( x or y ):
> i understand: if x expression = True OR y expression = True then execute
>
You didn't read MRABs explanation, did you?

> if '=' not in ( name and month and year ):
> i understand: if '=' not in name AND '=' not in month AND '=' not in year
>
Wrong. The "'=' not in (...)" first evaluates the expression in 
parentheses, that's what parentheses are for. And then it looks for '=' 
in the result. And that result is just one of the three values, MRAB 
told you which one.

>
> if '=' not in ( name or month or year ):
> i understand: if '=' not in name OR '=' not in month OR '=' not in year
>
Same here. You can't take the "'=' in" out of the parentheses, that 
leads to a wrong result.
>
> but i know it does not work like this, but tis is how i understand it.

??? If you know it doesn't work like this, then it won't help you to 
wilfully understand something you'd like to be true.

> its like reading an English sentence
>
No, this time it isn't.

HTH
Sibylle

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


#47836

FromΝικόλαος Κούρας <support@superhost.gr>
Date2013-06-12 23:00 +0300
Message-ID<kpak0s$qvj$2@news.ntua.gr>
In reply to#47835
On 12/6/2013 10:48 μμ, Sibylle Koczian wrote:
>> if '=' not in ( name and month and year ):
>> i understand: if '=' not in name AND '=' not in month AND '=' not in year
>>
> Wrong. The "'=' not in (...)" first evaluates the expression in
> parentheses, that's what parentheses are for. And then it looks for '='
> in the result. And that result is just one of the three values, MRAB
> told you which one.

okey first the expression eval:

( name and month and year ) = ( name=True and month=True and year=True )

then if '=' not in (name = True and month = True and year = True)

I still do not follow how this works. it just doesn't make any sense to 
me at all.


if '=' not in ( name and month and year ):
if '=' not in ( name or month or year ):

I try to read both of them them as an English sentence but i cannot.
how can you be able to understand this?

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


#47840

FromChris Angelico <rosuav@gmail.com>
Date2013-06-13 06:16 +1000
Message-ID<mailman.3125.1371068212.3114.python-list@python.org>
In reply to#47836
On Thu, Jun 13, 2013 at 6:00 AM, Νικόλαος Κούρας <support@superhost.gr> wrote:
> On 12/6/2013 10:48 μμ, Sibylle Koczian wrote:
>>>
>>> if '=' not in ( name and month and year ):
>>> i understand: if '=' not in name AND '=' not in month AND '=' not in year
>>>
>> Wrong. The "'=' not in (...)" first evaluates the expression in
>> parentheses, that's what parentheses are for. And then it looks for '='
>> in the result. And that result is just one of the three values, MRAB
>> told you which one.
>
>
> okey first the expression eval:
>
> ( name and month and year ) = ( name=True and month=True and year=True )
>
> then if '=' not in (name = True and month = True and year = True)
>
> I still do not follow how this works. it just doesn't make any sense to me
> at all.
>
>
>
> if '=' not in ( name and month and year ):
> if '=' not in ( name or month or year ):
>
> I try to read both of them them as an English sentence but i cannot.
> how can you be able to understand this?

Go read the docs. In Python, 'in' is an operator. It behaves like an
operator. It does not behave like magic. Stop expecting magic of
Python.

ChrisA

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


#47851

FromSibylle Koczian <nulla.epistola@web.de>
Date2013-06-12 23:16 +0200
Message-ID<mailman.3134.1371071791.3114.python-list@python.org>
In reply to#47836
Am 12.06.2013 22:00, schrieb Νικόλαος Κούρας:
> On 12/6/2013 10:48 μμ, Sibylle Koczian wrote:
>>> if '=' not in ( name and month and year ):
>>> i understand: if '=' not in name AND '=' not in month AND '=' not in
>>> year
>>>
>> Wrong. The "'=' not in (...)" first evaluates the expression in
>> parentheses, that's what parentheses are for. And then it looks for '='
>> in the result. And that result is just one of the three values, MRAB
>> told you which one.
>
> okey first the expression eval:
>
> ( name and month and year ) = ( name=True and month=True and year=True )
>
No. Read MRABs post, he explains it. Or work through the tutorial. This 
would be right in another language, but not in Python.

If this expression would really evaluate to True or False, you 
definitely couldn't search for any character in the result.

As it is, it evaluates to a string or to None, but searching for '=' in 
that string doesn't give the result you think it does.

Greetings
Sibylle

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


#47972

FromΝικόλαος Κούρας <support@superhost.gr>
Date2013-06-13 17:47 +0300
Message-ID<kpcm21$21co$1@news.ntua.gr>
In reply to#47851
On 13/6/2013 12:16 πμ, Sibylle Koczian wrote:
> Am 12.06.2013 22:00, schrieb Νικόλαος Κούρας:
>> On 12/6/2013 10:48 μμ, Sibylle Koczian wrote:
>>>> if '=' not in ( name and month and year ):
>>>> i understand: if '=' not in name AND '=' not in month AND '=' not in
>>>> year
>>>>
>>> Wrong. The "'=' not in (...)" first evaluates the expression in
>>> parentheses, that's what parentheses are for. And then it looks for '='
>>> in the result. And that result is just one of the three values, MRAB
>>> told you which one.
>>
>> okey first the expression eval:
>>
>> ( name and month and year ) = ( name=True and month=True and year=True )
>>
> No. Read MRABs post, he explains it. Or work through the tutorial. This
> would be right in another language, but not in Python.
>
> If this expression would really evaluate to True or False, you
> definitely couldn't search for any character in the result.
>
> As it is, it evaluates to a string or to None, but searching for '=' in
> that string doesn't give the result you think it does.

(name and month and year) is a Boolean expression, correct?

It will return True if all three are True and False otherwise. I cannot 
use it the way i desire regardless of how logical i think it looks.

Basically its just like i'am saying:


if "-" in True:
or
if "-" in False:

Obviously when i write it this way you can see it makes no sense.

======================
But (name or month or year) is also a Boolean expression.

It will return the first of the three depending which value comes first 
as truthy.
it will return False if none of the three are False.

So how am i going to write it that?

if '-' not in name and '-' not in month and '-' not in year:  ??????

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


#47884

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

> doesn't that mean?
> 
> 		if '=' not in ( name and month and year ):
> 
> if '=' does not exists as a char inside the name and month and year
> variables?
> 
> i think it does, but why it fails then?

No. Python is very close to "English-like", but not exactly, and this is 
one of the easiest places to trip.

In English:

"the cat is in the box or the cupboard or the kitchen"

means:

"the cat is in the box, or the cat is in the cupboard, or the cat is in 
the kitchen".


But that is not how Python works. In Python, you have to say:

cat in box or cat in cupboard or cat in kitchen


Although this will work as well:

any(cat in place for place in (box, cupboard, kitchen)) 


In Python, an expression like this:

cat in (box or cupboard or kitchen)


has a completely different meaning. First, the expression in the round 
brackets is evaluated:

(box or cupboard or kitchen)


and then the test is performed:

cat in (result of the above)


The expression (box or cupboard or kitchen) means "return the first one 
of box, cupboard, kitchen that is a truthy value, otherwise the last 
value". Truthy values are those which are considered to be "like True":

truthy values:

- True
- object()
- numbers apart from zero
- non-empty strings
- non-empty lists
- non-empty sets
- non-empty dicts
- etc.

falsey:

- False
- None
- zero (0, 0.0, Decimal(0), Fraction(0), etc.)
- empty string
- empty list
- empty set
- empty dict
- etc.

(Can you see the pattern?)


So you can experiment with this yourself:

42 or 23 or "foo"
=> the first object is truthy, so it is returned

0 or 23 or "foo"
=> the first object is falsey, and the second object is truthy, 
so it is returned

0 or [] or "foo"
=> the first two objects are falsey, so the third is returned


The "and" operator works in a similar fashion. Experiment with it and see 
how it works for yourself.



-- 
Steven

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


#47885

FromChris Angelico <rosuav@gmail.com>
Date2013-06-13 12:03 +1000
Message-ID<mailman.3154.1371089041.3114.python-list@python.org>
In reply to#47884
On Thu, Jun 13, 2013 at 11:55 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> In English:
>
> "the cat is in the box or the cupboard or the kitchen"
>
> means:
>
> "the cat is in the box, or the cat is in the cupboard, or the cat is in
> the kitchen".
>
>
> But that is not how Python works. In Python, you have to say:
>
> cat in box or cat in cupboard or cat in kitchen

Or you can deem that there be one single location that is the merging
of box, cupboard, and kitchen, and say:

cat in (box+cupboard+kitchen)

which works fine for character-in-string and element-in-list searches.

ChrisA

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


#47894

FromKushal Kumaran <kushal.kumaran+python@gmail.com>
Date2013-06-13 10:05 +0530
Message-ID<mailman.3160.1371098165.3114.python-list@python.org>
In reply to#47884
Chris Angelico <rosuav@gmail.com> writes:

> On Thu, Jun 13, 2013 at 11:55 AM, Steven D'Aprano
> <steve+comp.lang.python@pearwood.info> wrote:
>> In English:
>>
>> "the cat is in the box or the cupboard or the kitchen"
>>
>> means:
>>
>> "the cat is in the box, or the cat is in the cupboard, or the cat is in
>> the kitchen".
>>
>>
>> But that is not how Python works. In Python, you have to say:
>>
>> cat in box or cat in cupboard or cat in kitchen
>
> Or you can deem that there be one single location that is the merging
> of box, cupboard, and kitchen, and say:
>
> cat in (box+cupboard+kitchen)
>
> which works fine for character-in-string and element-in-list searches.
>

hm...

In [1]: s1 = 'abc'

In [2]: s2 = 'def'

In [3]: s3 = 'ghi'

In [4]: 'cd' in s1 or 'cd' in s2 or 'cd' in s3
Out[4]: False

In [5]: 'cd' in s1+s2+s3
Out[5]: True

-- 
regards,
kushal

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


#47895

FromChris Angelico <rosuav@gmail.com>
Date2013-06-13 14:39 +1000
Message-ID<mailman.3161.1371098350.3114.python-list@python.org>
In reply to#47884
On Thu, Jun 13, 2013 at 2:35 PM, Kushal Kumaran
<kushal.kumaran+python@gmail.com> wrote:
> In [4]: 'cd' in s1 or 'cd' in s2 or 'cd' in s3
> Out[4]: False
>
> In [5]: 'cd' in s1+s2+s3
> Out[5]: True

That's why I said it works for *character* in string, not *string* in
string. If your first operand is a single character (which in Python
is still of type 'str'), then the equivalency holds.

ChrisA

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


#47899

FromΝικόλαος Κούρας <support@superhost.gr>
Date2013-06-13 08:36 +0300
Message-ID<kpblpc$qvk$1@news.ntua.gr>
In reply to#47884
On 13/6/2013 4:55 πμ, Steven D'Aprano wrote:
> On Wed, 12 Jun 2013 14:17:32 +0300, Νικόλαος Κούρας wrote:
>
>> doesn't that mean?
>>
>> 		if '=' not in ( name and month and year ):
>>
>> if '=' does not exists as a char inside the name and month and year
>> variables?
>>
>> i think it does, but why it fails then?
>
> No. Python is very close to "English-like", but not exactly, and this is
> one of the easiest places to trip.
>
> In English:
>
> "the cat is in the box or the cupboard or the kitchen"
>
> means:
>
> "the cat is in the box, or the cat is in the cupboard, or the cat is in
> the kitchen".
>
>
> But that is not how Python works. In Python, you have to say:
>
> cat in box or cat in cupboard or cat in kitchen
>
>
> Although this will work as well:
>
> any(cat in place for place in (box, cupboard, kitchen))
>
>
> In Python, an expression like this:
>
> cat in (box or cupboard or kitchen)
>
>
> has a completely different meaning. First, the expression in the round
> brackets is evaluated:
>
> (box or cupboard or kitchen)
>
>
> and then the test is performed:
>
> cat in (result of the above)
>
>
> The expression (box or cupboard or kitchen) means "return the first one
> of box, cupboard, kitchen that is a truthy value, otherwise the last
> value". Truthy values are those which are considered to be "like True":
>
> truthy values:
>
> - True
> - object()
> - numbers apart from zero
> - non-empty strings
> - non-empty lists
> - non-empty sets
> - non-empty dicts
> - etc.
>
> falsey:
>
> - False
> - None
> - zero (0, 0.0, Decimal(0), Fraction(0), etc.)
> - empty string
> - empty list
> - empty set
> - empty dict
> - etc.
>
> (Can you see the pattern?)
>
>
> So you can experiment with this yourself:
>
> 42 or 23 or "foo"
> => the first object is truthy, so it is returned
>
> 0 or 23 or "foo"
> => the first object is falsey, and the second object is truthy,
> so it is returned
>
> 0 or [] or "foo"
> => the first two objects are falsey, so the third is returned
>
>
> The "and" operator works in a similar fashion. Experiment with it and see
> how it works for yourself.

First i wan tot thank you for taking the time to explain to me (the 
languages examples to explai encode-decode was really great as well)


So, baring in ming your explanation:

if '=' not in ( name or month or year )

first eval the expr. The expr will result to return the first object 
that has a truthy values.

in this particular example all 3 strings are truthies because they all 
contain characters inside them, the one user submitted when hitting the 
submit button

so that would turn to if '=' not in ( name ).
Allright, but what i wanted to check is if the char '=' ain't contained 
in both 3 strings not for the 1st string(name) which will always be true.

So i guess having it like this "if '=' not in ( name or month or year )" 
  is wrong?


b) Also what "if '=' not in ( name and month and year )" returns in the 
round brackets since in my case all the strings have values therefore 
they are true, which string get returned?

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


#47913

FromΝικόλαος Κούρας <support@superhost.gr>
Date2013-06-13 10:11 +0300
Message-ID<kpbraq$qvk$6@news.ntua.gr>
In reply to#47884
On 13/6/2013 4:55 πμ, Steven D'Aprano wrote:
> On Wed, 12 Jun 2013 14:17:32 +0300, Νικόλαος Κούρας wrote:
>
>> doesn't that mean?
>>
>> 		if '=' not in ( name and month and year ):
>>
>> if '=' does not exists as a char inside the name and month and year
>> variables?
>>
>> i think it does, but why it fails then?
>
> No. Python is very close to "English-like", but not exactly, and this is
> one of the easiest places to trip.
>
> In English:
>
> "the cat is in the box or the cupboard or the kitchen"
>
> means:
>
> "the cat is in the box, or the cat is in the cupboard, or the cat is in
> the kitchen".
>
>
> But that is not how Python works. In Python, you have to say:
>
> cat in box or cat in cupboard or cat in kitchen
>
>
> Although this will work as well:
>
> any(cat in place for place in (box, cupboard, kitchen))
>
>
> In Python, an expression like this:
>
> cat in (box or cupboard or kitchen)
>
>
> has a completely different meaning. First, the expression in the round
> brackets is evaluated:
>
> (box or cupboard or kitchen)
>
>
> and then the test is performed:
>
> cat in (result of the above)
>
>
> The expression (box or cupboard or kitchen) means "return the first one
> of box, cupboard, kitchen that is a truthy value, otherwise the last
> value". Truthy values are those which are considered to be "like True":
>
> truthy values:
>
> - True
> - object()
> - numbers apart from zero
> - non-empty strings
> - non-empty lists
> - non-empty sets
> - non-empty dicts
> - etc.
>
> falsey:
>
> - False
> - None
> - zero (0, 0.0, Decimal(0), Fraction(0), etc.)
> - empty string
> - empty list
> - empty set
> - empty dict
> - etc.
>
> (Can you see the pattern?)
>
>
> So you can experiment with this yourself:
>
> 42 or 23 or "foo"
> => the first object is truthy, so it is returned
>
> 0 or 23 or "foo"
> => the first object is falsey, and the second object is truthy,
> so it is returned
>
> 0 or [] or "foo"
> => the first two objects are falsey, so the third is returned
>
>
> 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.


		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 beutifull saying:

if character '-' aint 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]


Page 3 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