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


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

I am out of trial and error again Lists

Started bySeymore4Head <Seymore4Head@Hotmail.invalid>
First post2014-10-22 16:30 -0400
Last post2014-10-25 22:15 +0000
Articles 17 on this page of 157 — 23 participants

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


Contents

  I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 16:30 -0400
    Re: I am out of trial and error again Lists Joel Goldstick <joel.goldstick@gmail.com> - 2014-10-22 16:57 -0400
      Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 17:04 -0400
        Re: I am out of trial and error again Lists sohcahtoa82@gmail.com - 2014-10-22 14:35 -0700
          Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 17:38 -0400
    Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-22 22:28 +0100
    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 18:30 -0400
      Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 18:32 -0400
      Re: I am out of trial and error again  Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-22 23:55 +0100
        Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 19:26 -0400
          Re: I am out of trial and error again  Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-23 00:44 +0100
            Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 20:02 -0400
              Re: I am out of trial and error again  Lists MRAB <python@mrabarnett.plus.com> - 2014-10-23 02:29 +0100
              Re: I am out of trial and error again  Lists alex23 <wuwei23@gmail.com> - 2014-10-23 11:37 +1000
                Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 21:52 -0400
              Re: I am out of trial and error again  Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-22 19:58 -0700
                Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 23:05 -0400
                Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-22 20:16 -0700
                Re: I am out of trial and error again  Lists Terry Reedy <tjreedy@udel.edu> - 2014-10-23 02:31 -0400
      Re: I am out of trial and error again  Lists MRAB <python@mrabarnett.plus.com> - 2014-10-23 00:09 +0100
      Re: I am out of trial and error again  Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-23 00:10 -0700
        Re: I am out of trial and error again  Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-23 09:23 -0400
          Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:00 -0400
            Re: I am out of trial and error again  Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-23 20:23 -0400
        Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 09:53 -0400
      Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-23 09:15 +0000
        Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:04 -0400
          Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-23 15:55 +0000
            Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 13:01 -0400
              Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 13:07 -0400
                Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-23 13:39 -0600
                  Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 16:15 -0400
                  Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 16:44 -0400
                    Re: I am out of trial and error again Lists MRAB <python@mrabarnett.plus.com> - 2014-10-23 22:03 +0100
                    Re: I am out of trial and error again Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-23 19:13 -0700
                Re: I am out of trial and error again Lists Terry Reedy <tjreedy@udel.edu> - 2014-10-23 23:14 -0400
                Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-24 14:32 +1100
              Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-23 21:56 -0700
                Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 10:38 -0400
                  Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 01:51 +1100
                    Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 11:04 -0400
                      Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 02:13 +1100
                  Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 08:56 -0700
                    Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-24 10:35 -0600
                      Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 10:10 -0700
                    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 12:37 -0400
                      Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 03:47 +1100
                        Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 09:56 -0700
                        Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 13:03 -0400
                          Re: I am out of trial and error again Lists "Albert Visser" <albert.visser@gmail.com> - 2014-10-24 19:18 +0200
                            Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 13:23 -0400
                              Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 10:42 -0700
                                Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 13:42 -0400
                          Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-24 11:52 -0600
                            Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 14:15 -0400
                              Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 14:20 -0400
                                Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-24 19:40 +0100
                                  Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 15:07 -0400
                                    Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 21:49 +0000
                                    Re: I am out of trial and error again Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-24 23:46 -0700
                                      Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-25 08:17 -0600
                                    Re: I am out of trial and error again Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-25 14:47 -0400
                              Re: I am out of trial and error again Lists sohcahtoa82@gmail.com - 2014-10-24 11:57 -0700
                                Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 15:09 -0400
                                  Re: I am out of trial and error again Lists sohcahtoa82@gmail.com - 2014-10-24 12:25 -0700
                                    Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 15:33 -0400
                                      Re: I am out of trial and error again Lists sohcahtoa82@gmail.com - 2014-10-24 12:55 -0700
                                        Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 16:00 -0400
                              Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 21:19 +0000
                                Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 17:35 -0400
                                  Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 23:23 +0000
                              Re: I am out of trial and error again Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-25 14:37 -0400
                          Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-24 19:33 +0100
                      Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 09:54 -0700
                        Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 13:04 -0400
                          Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 10:17 -0700
                          Re: I am out of trial and error again  Lists Dave Angel <davea@davea.name> - 2014-10-24 18:09 -0400
                            Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 18:27 -0400
                              Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 16:01 -0700
                              Re: I am out of trial and error again  Lists Terry Reedy <tjreedy@udel.edu> - 2014-10-24 20:27 -0400
                                Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 20:42 -0400
                      Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-24 11:05 -0600
                      Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 04:10 +1100
                      Re: I am out of trial and error again  Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-24 23:04 -0700
                  Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 20:37 +0000
                    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 16:58 -0400
                      Re: I am out of trial and error again  Lists alister <alister.nospam.ware@ntlworld.com> - 2014-10-24 21:07 +0000
                      Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-24 15:11 -0600
                      Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 23:21 +0000
                        Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 19:48 -0400
                  Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 21:48 +0000
                    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 18:14 -0400
                    Re: I am out of trial and error again  Lists Grant Edwards <invalid@invalid.invalid> - 2014-10-25 15:01 +0000
                      Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-25 20:51 +0000
                  Re: I am out of trial and error again  Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-24 19:16 -0700
                    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 22:41 -0400
                      Re: I am out of trial and error again  Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-25 08:25 +0100
                      Re: I am out of trial and error again  Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-25 15:10 -0400
                  Re: I am out of trial and error again  Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-25 14:23 -0400
                    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-25 14:42 -0400
                  Re: I am out of trial and error again  Lists Terry Reedy <tjreedy@udel.edu> - 2014-10-25 18:48 -0400
                  Re: I am out of trial and error again  Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-26 00:25 +0100
                  Re: I am out of trial and error again  Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-26 01:08 -0400
                  Re: I am out of trial and error again  Lists Terry Reedy <tjreedy@udel.edu> - 2014-10-26 17:44 -0400
                  Re: I am out of trial and error again  Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-26 20:57 -0400
    Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-22 22:43 +0000
      Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 19:11 -0400
        The “trials” in “trial and error” should be as simple as possible (was: I am out of trial and error again  Lists) Ben Finney <ben+python@benfinney.id.au> - 2014-10-23 10:59 +1100
        Re: I am out of trial and error again  Lists Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-23 11:05 +1100
          Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 20:10 -0400
            Re: I am out of trial and error again  Lists MRAB <python@mrabarnett.plus.com> - 2014-10-23 02:31 +0100
              Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 21:35 -0400
                Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 21:57 -0400
                  Re: I am out of trial and error again  Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-23 08:20 +0100
                    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:01 -0400
                  Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-23 01:56 -0600
                  Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-23 09:09 +0100
                    Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-23 06:42 -0700
                      Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:03 -0400
                        Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-23 08:35 -0700
                      Re: I am out of trial and error again Lists giacomo boffi <pecore@pascolo.net> - 2014-10-23 16:25 +0200
                        Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:29 -0400
                        Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-23 16:00 +0000
                Re: I am out of trial and error again  Lists giacomo boffi <pecore@pascolo.net> - 2014-10-23 16:40 +0200
                  Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:46 -0400
                  Re: I am out of trial and error again  Lists giacomo boffi <pecore@pascolo.net> - 2014-10-24 17:56 +0200
        Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-23 09:21 +0000
    Re: I am out of trial and error again  Lists Tobiah <toby@tobiah.org> - 2014-10-23 07:51 -0700
    Re: I am out of trial and error again  Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-24 08:05 +0100
      Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 10:47 -0400
        Re: I am out of trial and error again  Lists mm0fmf <none@mailinator.com> - 2014-10-24 22:06 +0100
    Re: I am out of trial and error again  Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-24 09:12 +0100
      Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 10:48 -0400
    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 18:26 -0400
    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 18:58 -0400
      Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 16:27 -0700
        Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 19:48 -0400
          Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 19:57 -0400
            Re: I am out of trial and error again  Lists MRAB <python@mrabarnett.plus.com> - 2014-10-25 01:20 +0100
              Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 20:37 -0400
                Re: I am out of trial and error again  Lists Cameron Simpson <cs@zip.com.au> - 2014-10-25 11:52 +1100
          Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 20:46 -0700
            Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 21:09 -0700
              Re: I am out of trial and error again  Lists Ben Finney <ben+python@benfinney.id.au> - 2014-10-25 15:25 +1100
                Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 22:40 -0700
                  Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 16:49 +1100
                    Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 22:55 -0700
                      Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 17:03 +1100
                      Re: I am out of trial and error again Lists Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-25 18:44 +1100
                        Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-25 10:24 -0700
                    Side-effects [was Re: I am out of trial and error again Lists] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-26 17:12 +1100
                      Re: Side-effects [was Re: I am out of trial and error again Lists] Chris Angelico <rosuav@gmail.com> - 2014-10-26 17:42 +1100
            Re: I am out of trial and error again  Lists giacomo boffi <pecore@pascolo.net> - 2014-10-27 22:26 +0100
      Re: I am out of trial and error again  Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-25 00:27 +0100
      Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 23:35 +0000
    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 20:15 -0400
      Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-25 22:15 +0000

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


#79642

FromCameron Simpson <cs@zip.com.au>
Date2014-10-25 11:52 +1100
Message-ID<mailman.15151.1414199621.18130.python-list@python.org>
In reply to#79640
On 24Oct2014 20:37, Seymore4Head <Seymore4Head@Hotmail.invalid> wrote:
>On Sat, 25 Oct 2014 01:20:53 +0100, MRAB <python@mrabarnett.plus.com>
>>One function you can use is repr:
>>
>>x = 1
>>y = "1"
>>print(repr(x))
>>print(repr(y))
>>
>>This will print:
>>
>>1
>>'1'
>>
>>OK, now it's clear that x is an int and y is a string.
>
>Yes

In particular, Python's interactive mode uses repr to print the result of any 
expression that whose value was not None:

   [/Users/cameron]fleet*> python
   Python 2.7.8 (default, Oct  3 2014, 02:34:26)
   [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
   Type "help", "copyright", "credits" or "license" for more information.
   >>> x=1
   >>> y='1'
   >>> x
   1
   >>> y
   '1'
   >>>

so you get this for free in that mode.

Cheers,
Cameron Simpson <cs@zip.com.au>

If your new theorem can be stated with great simplicity, then there
will exist a pathological exception.    - Adrian Mathesis

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


#79650

FromRustom Mody <rustompmody@gmail.com>
Date2014-10-24 20:46 -0700
Message-ID<e80c48b8-ab00-4d6c-9bfa-bdacfdac0dbb@googlegroups.com>
In reply to#79634
On Saturday, October 25, 2014 5:21:01 AM UTC+5:30, Seymore4Head wrote:
> On Fri, 24 Oct 2014 16:27:58 -0700 (PDT), Rustom Mody wrote:
> 
> >On Saturday, October 25, 2014 4:30:47 AM UTC+5:30, Seymore4Head wrote:
> >> On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote:
> >> 
> >> name="123-xyz-abc" 
> >> a=range(10)
> >> b=list(range(10))
> >> c=str(list(range(10)))
> >> print ("a",(a))
> >> print ("b",(b))
> >> print ("c",(c))
> >> 
> >> for x in name:
> >>     if x in a:
> >>         print ("a",(x))      
> >>     if x in b:
> >>         print ("b",(x))  
> >>     if x in c:
> >>         print ("c",(x))
> >> 
> >> B is type list and C is type str.
> >> I guess I am still a little too thick.  I would expect b and c to
> >> work. 
> >
> >Lets simplify the problem a bit.
> >Do all the following in interpreter window
> >
> >>>> name="012"
> >>>> b=list(range(3))
> >
> >>>> for x in name:  print x
> >
> >>>> for x in b: print x
> >
> >Same or different?
> >
> >Now go back to Denis' nice example and put in type(x)
> >into each print
> >
> >Same or different?
> 
> First.  The interpreter is not good for me to use even when I am using
> Python 3 because I forget to add :  and I forget to put () around the
> print statements.
> 

What would you say to a person who
- Buys a Lambhorgini
- Hitches a horse (or bullock) to it
- Moans how clumsily slow it is.

   ??

In case you dont get it:

- the interpreter is one of the factors that puts python into the hi-end class.
- the bullock/horse class is the C/Java type language where you always 
need to work through files

Here is my list of points of sliding for bullock category to Lambhorgini:
http://blog.languager.org/2012/10/functional-programming-lost-booty.html
['Interpreter' is called 'REPL' there]

> To keep me from having to correct myself every time I use it, it is
> just easier to make a short py file.

Yes the intention is right, The implementation is wrong.

Programmers consider it a virtue to be lazy.
But you have to put it some work to learn to be lazy in an effective way
And currently you are being lazy on the wrong front.

Hints:
1. A good programmer tries out things at the interpreter ONE LINE AT A TIME
2. What he tries out are usually EXPRESSIONS like eg
   str(list(range(10)))

   And not STATEMENTS like
   if x in name: 
          print x

3. IOW a good programmer rarely needs to type a colon at the interpreter

4. The least useful statement to try at the interpreter is print.

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


#79651

FromRustom Mody <rustompmody@gmail.com>
Date2014-10-24 21:09 -0700
Message-ID<25c6a468-e596-4a31-856b-bb5fe22c8894@googlegroups.com>
In reply to#79650
On Saturday, October 25, 2014 9:17:12 AM UTC+5:30, Rustom Mody wrote:
> 4. The least useful statement to try at the interpreter is print.

Yeah this is python2 thinking; in python 3, print is technically an expression.

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


#79652

FromBen Finney <ben+python@benfinney.id.au>
Date2014-10-25 15:25 +1100
Message-ID<mailman.15156.1414211150.18130.python-list@python.org>
In reply to#79651
Rustom Mody <rustompmody@gmail.com> writes:

> On Saturday, October 25, 2014 9:17:12 AM UTC+5:30, Rustom Mody wrote:
> > 4. The least useful statement to try at the interpreter is print.
>
> Yeah this is python2 thinking; in python 3, print is technically an
> expression.

This is wrong thinking. In Python 3, print is a function.

-- 
 \           “[W]hoever is able to make you absurd is able to make you |
  `\                                                unjust.” —Voltaire |
_o__)                                                                  |
Ben Finney

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


#79656

FromRustom Mody <rustompmody@gmail.com>
Date2014-10-24 22:40 -0700
Message-ID<9dd6db37-5568-405e-8af7-3a28195eec4d@googlegroups.com>
In reply to#79652
On Saturday, October 25, 2014 9:56:02 AM UTC+5:30, Ben Finney wrote:
> Rustom Mody writes:
> 
> > On Saturday, October 25, 2014 9:17:12 AM UTC+5:30, Rustom Mody wrote:
> > > 4. The least useful statement to try at the interpreter is print.
> >
> > Yeah this is python2 thinking; in python 3, print is technically an
> > expression.
> 
> This is wrong thinking. In Python 3, print is a function.

[tl;dr at bottom]

Ok I was a bit sloppy -- should have said 'the print'
But there was no specific prior use that 'the' would refer to.
So one could say (if you like!):

|          | Python 2  | Python 3   |
| print    | syntax    | function   |
| print(x) | statement | expression |

I was really talking of the second row not the first

So much for being legalistic -- An approach which is ultimately not helpful.

For one thing function is one kind of expression ie its a subset not a disjoint relation.

More important (in this case) its bad pedagogy.
Its generally accepted that side-effecting functions are not a good idea
-- typically a function that returns something and changes global state.

In that sense its best to think of print(x) as syntactically an expression, 
semantically a statement.

Or put differently, the following error is more poorly reported in
python3 than in python2

Python 2.7.8 (default, Oct  7 2014, 17:59:21) 
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 2 + (print 2)
  File "<stdin>", line 1
    2 + (print 2)
             ^
SyntaxError: invalid syntax


Python 3.4.2 (default, Oct  8 2014, 10:45:20) 
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 2 + (print (2))
2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'

=========
tl;dr I dont think all this is very helpful to Seymore

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


#79657 — Re: I am out of trial and error again Lists

FromChris Angelico <rosuav@gmail.com>
Date2014-10-25 16:49 +1100
SubjectRe: I am out of trial and error again Lists
Message-ID<mailman.15158.1414216160.18130.python-list@python.org>
In reply to#79656
On Sat, Oct 25, 2014 at 4:40 PM, Rustom Mody <rustompmody@gmail.com> wrote:
> Its generally accepted that side-effecting functions are not a good idea
> -- typically a function that returns something and changes global state.

Only in certain circles. Not in Python. There are large numbers of
functions with side effects (mutator methods like list.append,
anything that needs lots of state like random.random, everything with
external effect like I/O, heaps of stuff), and it is most definitely
not frowned upon.

In Python 3 (or Python 2 with the future directive), print is a
function, print() an expression. It's not "semantically a statement".

ChrisA

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


#79658 — Re: I am out of trial and error again Lists

FromRustom Mody <rustompmody@gmail.com>
Date2014-10-24 22:55 -0700
SubjectRe: I am out of trial and error again Lists
Message-ID<e83e1e38-473f-4956-9574-ec2fe55f16ce@googlegroups.com>
In reply to#79657
On Saturday, October 25, 2014 11:20:03 AM UTC+5:30, Chris Angelico wrote:
> On Sat, Oct 25, 2014 at 4:40 PM, Rustom Mody  wrote:
> > Its generally accepted that side-effecting functions are not a good idea
> > -- typically a function that returns something and changes global state.
> 
> Only in certain circles. Not in Python. There are large numbers of
> functions with side effects (mutator methods like list.append,
> anything that needs lots of state like random.random, everything with
> external effect like I/O, heaps of stuff), and it is most definitely
> not frowned upon.
> 
> In Python 3 (or Python 2 with the future directive), print is a
> function, print() an expression. It's not "semantically a statement".

Ok
So give me a valid (ie useful) use where instead of the usual
l=[1,2,3]
l.append(4)

we have

foo(l.append(4))

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


#79659 — Re: I am out of trial and error again Lists

FromChris Angelico <rosuav@gmail.com>
Date2014-10-25 17:03 +1100
SubjectRe: I am out of trial and error again Lists
Message-ID<mailman.15159.1414217031.18130.python-list@python.org>
In reply to#79658
On Sat, Oct 25, 2014 at 4:55 PM, Rustom Mody <rustompmody@gmail.com> wrote:
> So give me a valid (ie useful) use where instead of the usual
> l=[1,2,3]
> l.append(4)
>
> we have
>
> foo(l.append(4))

Given that l.append(4) will always return None, there's not a lot of
point passing that return value to something, unless you're doing this
inside a lambda or something dumb like that. It won't be Pythonic.
Your point?

ChrisA

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


#79663 — Re: I am out of trial and error again Lists

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2014-10-25 18:44 +1100
SubjectRe: I am out of trial and error again Lists
Message-ID<544b54ea$0$13011$c3e8da3$5496439d@news.astraweb.com>
In reply to#79658
Rustom Mody wrote:

> On Saturday, October 25, 2014 11:20:03 AM UTC+5:30, Chris Angelico wrote:
>> On Sat, Oct 25, 2014 at 4:40 PM, Rustom Mody  wrote:
>> > Its generally accepted that side-effecting functions are not a good
>> > idea -- typically a function that returns something and changes global
>> > state.
>> 
>> Only in certain circles. Not in Python. There are large numbers of
>> functions with side effects (mutator methods like list.append,
>> anything that needs lots of state like random.random, everything with
>> external effect like I/O, heaps of stuff), and it is most definitely
>> not frowned upon.
>> 
>> In Python 3 (or Python 2 with the future directive), print is a
>> function, print() an expression. It's not "semantically a statement".
> 
> Ok
> So give me a valid (ie useful) use where instead of the usual
> l=[1,2,3]
> l.append(4)
> 
> we have
> 
> foo(l.append(4))

Your question seems to be non-sequitor. To me, it doesn't appear to have any
relationship to Chris' comments.

But to answer your question, Ruby has mutator methods like list.append
return the list being mutated, to make it easy to chain multiple calls:

l.append(4).reverse().sort()


That would make it easy and convenient to modify a list immediately pass the
modified list to a function and embed it in an expression:

# Python's way
l.append(4)
values = [1, 2, foo(l), 3]

# Pseudo-Ruby way
values = [1, 2, foo(l.append(4)), 3]


Languages where all values are immutable *by definition* have to return a
new list, since you can't modify the original, hence they too can easily be
embedded in an expression.

Many people try to write something like this:

old_lists = [a, b, c, d]
new_lists = [thelist.append(x) for thelist in old_lists if len(thelist) < 5]

only to be unpleasantly surprised to discover than new_lists now contains
None instead of the lists. Having methods return a result rather than
behave like a procedure is a valid (i.e. useful) design choice.


-- 
Steven

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


#79674 — Re: I am out of trial and error again Lists

FromRustom Mody <rustompmody@gmail.com>
Date2014-10-25 10:24 -0700
SubjectRe: I am out of trial and error again Lists
Message-ID<89e60f4f-8fe4-4393-afd1-f9f698d10bac@googlegroups.com>
In reply to#79663
On Saturday, October 25, 2014 1:15:09 PM UTC+5:30, Steven D'Aprano wrote:
> Rustom Mody wrote:
> 
> > On Saturday, October 25, 2014 11:20:03 AM UTC+5:30, Chris Angelico wrote:
> >> On Sat, Oct 25, 2014 at 4:40 PM, Rustom Mody  wrote:
> >> > Its generally accepted that side-effecting functions are not a good
> >> > idea -- typically a function that returns something and changes global
> >> > state.
> >> 
> >> Only in certain circles. Not in Python. There are large numbers of
> >> functions with side effects (mutator methods like list.append,
> >> anything that needs lots of state like random.random, everything with
> >> external effect like I/O, heaps of stuff), and it is most definitely
> >> not frowned upon.
> >> 
> >> In Python 3 (or Python 2 with the future directive), print is a
> >> function, print() an expression. It's not "semantically a statement".
> > 
> > Ok
> > So give me a valid (ie useful) use where instead of the usual
> > l=[1,2,3]
> > l.append(4)
> > 
> > we have
> > 
> > foo(l.append(4))
> 
> Your question seems to be non-sequitor. To me, it doesn't appear to have any
> relationship to Chris' comments.

I am going to leave undisturbed Seymore's thread for whom these nit-picks are unlikely to be helpful

Answer in another one

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


#79705 — Side-effects [was Re: I am out of trial and error again Lists]

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2014-10-26 17:12 +1100
SubjectSide-effects [was Re: I am out of trial and error again Lists]
Message-ID<544c90c6$0$12986$c3e8da3$5496439d@news.astraweb.com>
In reply to#79657
Chris Angelico wrote:

> On Sat, Oct 25, 2014 at 4:40 PM, Rustom Mody <rustompmody@gmail.com>
> wrote:
>> Its generally accepted that side-effecting functions are not a good idea
>> -- typically a function that returns something and changes global state.
> 
> Only in certain circles. Not in Python. There are large numbers of
> functions with side effects (mutator methods like list.append,
> anything that needs lots of state like random.random, everything with
> external effect like I/O, heaps of stuff), and it is most definitely
> not frowned upon.

Hmmm. You might be overstating it a tad. You are absolutely correct that
Python is not a strict functional language with no side-effects.

However, mutator methods on a class don't change global state, they change
the state of an instance. Even random.random and friends don't change
global state, they change a (hidden) instance, and you can create your own
instances when needed. That gives you the convenience of pseudo-global
state while still allowing the flexibility of having separate instances.
Even global variables in Python are global to the module, not global to the
entire application.

So although Python code isn't entirely side-effect free, the general advice
to avoid writing code that relies on global state and operates via
side-effect still applies. To take an extreme example, we do this:

print(len(something))

not this:

LEN_ARGUMENT = something
len()
print(LEN_RESULT)

We *could* write code like that in Python, but as a general rule we don't.
If we did, it would be frowned upon. I would say that Python is a pragmatic
language which uses whatever idiom seems best at the time, but over all it
prefers mutable state for compound objects, prefers immutable state for
scalar objects (like numbers), and discourages the unnecessary use of
global mutable state.


-- 
Steven

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


#79706 — Re: Side-effects [was Re: I am out of trial and error again Lists]

FromChris Angelico <rosuav@gmail.com>
Date2014-10-26 17:42 +1100
SubjectRe: Side-effects [was Re: I am out of trial and error again Lists]
Message-ID<mailman.15190.1414305729.18130.python-list@python.org>
In reply to#79705
On Sun, Oct 26, 2014 at 5:12 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> However, mutator methods on a class don't change global state, they change
> the state of an instance. Even random.random and friends don't change
> global state, they change a (hidden) instance, and you can create your own
> instances when needed. That gives you the convenience of pseudo-global
> state while still allowing the flexibility of having separate instances.
> Even global variables in Python are global to the module, not global to the
> entire application.

True, but they do still change state; I oversimplified a bit, but
certainly there are plenty of functions that change state in some way,
and are not frowned upon.

Module level variables really are global, though. You can't easily and
conveniently reinstantiate a module in Python; if you "import random;
random.seed(1234)", you can confidently expect that some other module
that uses random.random will be affected. Sure, there are ways around
that, but that's true of any form of global state - for a start, it's
usually "process level" state, in that spawning a new process will
isolate one from another. The only thing that isn't truly global is
the namespace; I can write "x = {}" and you can write "x = []" and
they don't collide. They're still global (process-level), it's just
that they're "foo.x" and "bar.x" and are thus distinct.

> I would say that Python is a pragmatic
> language which uses whatever idiom seems best at the time, but over all it
> prefers mutable state for compound objects, prefers immutable state for
> scalar objects (like numbers), and discourages the unnecessary use of
> global mutable state.

It's not really compound vs scalar, but yes, I agree. Practicality
beats purity, on so many levels. Functions with side effects aren't
considered some sort of weird beast that we have to permit for the
sake of I/O; they're a fundamental part of the language.

ChrisA

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


#79804

Fromgiacomo boffi <pecore@pascolo.net>
Date2014-10-27 22:26 +0100
Message-ID<877fzl432a.fsf@pascolo.net>
In reply to#79650
Rustom Mody <rustompmody@gmail.com> writes:

> What would you say to a person who
> - Buys a Lambhorgini

I'd say: "Don't buy a Lambhorgini from that nice guy you met at a party,
          but buy a Lamborghini by an authorized dealer"  ;-)

-- 
I was a kid when Lamborghini launched the Miura!

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


#79632

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2014-10-25 00:27 +0100
Message-ID<mailman.15148.1414193287.18130.python-list@python.org>
In reply to#79627
On 24/10/2014 23:58, Seymore4Head wrote:
> On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head
> <Seymore4Head@Hotmail.invalid> wrote:
>
> name="123-xyz-abc"
> a=range(10)
> b=list(range(10))
> c=str(list(range(10)))
> print ("a",(a))
> print ("b",(b))
> print ("c",(c))
>
> for x in name:
>      if x in a:
>          print ("a",(x))
>      if x in b:
>          print ("b",(x))
>      if x in c:
>          print ("c",(x))
>
> B is type list and C is type str.
> I guess I am still a little too thick.  I would expect b and c to
> work.
> http://i.imgur.com/dT3sEQq.jpg
>

Why?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


#79633

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2014-10-24 23:35 +0000
Message-ID<m2enn6$mv8$11@dont-email.me>
In reply to#79627
On Fri, 24 Oct 2014 18:58:04 -0400, Seymore4Head wrote:

> On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head
> <Seymore4Head@Hotmail.invalid> wrote:

OK, assuming you tried to run this in python3, not python2 or 
codeskulptor.

> name="123-xyz-abc"
> a=range(10)

 ^^^^ a is an iterable object giving the numbers 0 through 9

> b=list(range(10))

 ^^^^ b is an list containing the numbers 0 through 9

> c=str(list(range(10)))

 ^^^^ c is an string representation of a list containing the numbers 0 
through 9

> print ("a",(a))
> print ("b",(b))
> print ("c",(c))
> 
> for x in name:

 ^^^^^ x is a string representing one character in name

>     if x in a:
>         print ("a",(x))

 ^^^^ here you are looking for a string x amongst the numbers yielded by 
an iterable

>     if x in b:
>         print ("b",(x))

 ^^^^ here you are comparing a string x with the elements of a list of 
numbers

>     if x in c:
>         print ("c",(x))

 ^^^^ here you are comparing a string x with the characters in a string 
representation of a list of numbers

> B is type list and C is type str.
> I guess I am still a little too thick.  I would expect b and c to work.
> http://i.imgur.com/dT3sEQq.jpg

a is the range object: range(0, 9)
b is the list: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
c is the string: "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"

When you try and compare a character x eg "8" with the numbers yielded by 
the iterable a, none of them match because character "8" is not the same 
as number 8

When you try and compare a character x eg "8" with the elements of the 
list b, none of them match because character "8" is not the same as 
number 8

When you try and compare a character x eg "8" with the string 
representation of the list b, you get a match of x "8" to the 25th 
character of string c which is also "8".

-- 
Denis McMahon, denismfmcmahon@gmail.com

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


#79637

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-10-24 20:15 -0400
Message-ID<erql4at25eruc770qs7v21tgt05ol2gbft@4ax.com>
In reply to#79469
On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head
<Seymore4Head@Hotmail.invalid> wrote:

name="012"
b=list(range(3))
print (name[1])
print (b[1])
if name[1] == b[1]:
    print ("Eureka!")
else:
    print ("OK, I get it")
 

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


#79686

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2014-10-25 22:15 +0000
Message-ID<m2h7e2$7rd$2@dont-email.me>
In reply to#79637
On Fri, 24 Oct 2014 20:15:02 -0400, Seymore4Head wrote:

> On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head
> <Seymore4Head@Hotmail.invalid> wrote:
> 
> name="012"

name is a string of 3 characters

> b=list(range(3))

b is a list of 3 numbers

> print (name[1])

name[1] is the string "1"

> print (b[1])

b[1] is the number 1

> if name[1] == b[1]:
>     print ("Eureka!")

This didn't happen

> else:
>     print ("OK, I get it")

This happened

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [standalone]


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

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


csiph-web