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


Groups > comp.lang.python > #76146

Re: how to get the ordinal number in list

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'beginner': 0.05; 'interpreter': 0.05; 'output': 0.05; 'beginners': 0.09; 'mess': 0.09; 'nice!': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'repeated': 0.09; 'subject:number': 0.09; 'def': 0.12; 'stored': 0.12; 'times,': 0.14; '(class': 0.16; 'advantage.': 0.16; "children's": 0.16; 'combined.': 0.16; 'creativity.': 0.16; 'formula': 0.16; 'instructor.': 0.16; 'it;': 0.16; 'magic': 0.16; 'manifest': 0.16; 'non-printing': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'repl': 0.16; 'scratch': 0.16; 'trivially': 0.16; 'utterly': 0.16; 'component': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'trying': 0.19; 'pieces': 0.19; 'input': 0.22; 'example': 0.22; 'programming': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'adds': 0.24; 'non': 0.24; 'together.': 0.24; 'sort': 0.25; "i've": 0.25; 'this:': 0.26; 'downloaded': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'function': 0.29; 'specifically': 0.29; 'wondering': 0.29; 'on,': 0.29; 'generally': 0.29; "doesn't": 0.30; 'subject:list': 0.30; "i'm": 0.30; 'getting': 0.31; 'towards': 0.31; 'usually': 0.31; 'breaking': 0.31; 'bunch': 0.31; 'idea,': 0.31; 'though.': 0.31; 'stuff': 0.32; 'another': 0.32; 'becomes': 0.33; 'screen': 0.34; 'subject:the': 0.34; 'could': 0.34; 'knowledge': 0.35; 'connection': 0.35; 'something': 0.35; 'objects': 0.35; 'but': 0.35; 'add': 0.35; 'there': 0.35; 'really': 0.36; 'shows': 0.36; 'similar': 0.36; 'should': 0.36; 'so,': 0.37; 'turn': 0.37; 'problems': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'little': 0.38; 'does': 0.39; '12,': 0.39; 'extremely': 0.39; 'functional': 0.39; 'to:addr:python.org': 0.39; 'enough': 0.39; 'received:org': 0.40; 'called': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'units': 0.60; 'august': 0.61; 'helps': 0.61; 'our': 0.64; 'more': 0.64; 'different': 0.65; 'teach': 0.65; 'natural': 0.68; 'combining': 0.68; 'subject:get': 0.81; 'composing': 0.84; 'dry': 0.84; 'obvious.': 0.84; 'screwed.': 0.84; 'benefits:': 0.91; 'lot,': 0.93; 'numerous': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From "Neil D. Cerutti" <neilc@norwich.edu>
Subject Re: how to get the ordinal number in list
Date Tue, 12 Aug 2014 15:29:35 -0400
References <53E658CD.5020904@gmail.com> <CACwCsY7icE7X2upr0auNhe37xh5HdC09Ad4yaetqpo+fcoBRYg@mail.gmail.com> <mailman.12780.1407551775.18130.python-list@python.org> <53e59035$0$29998$c3e8da3$5496439d@news.astraweb.com> <338e8fb0-c9ec-462a-b560-1c1ff77de17e@googlegroups.com> <roy-3060CA.11342209082014@news.panix.com> <b5ac5b12-cda7-464e-9c14-63ef184a7a10@googlegroups.com> <roy-FEFEEE.13102110082014@news.panix.com> <154cc342-7f85-4d16-b636-a1a953913c98@googlegroups.com> <roy-FD5EE7.14142310082014@news.panix.com> <mailman.12890.1407865263.18130.python-list@python.org> <70c65ab0-0a9d-4705-a8a3-43b9ee0600a0@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host jackman.norwich.edu
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
In-Reply-To <70c65ab0-0a9d-4705-a8a3-43b9ee0600a0@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.12898.1407871797.18130.python-list@python.org> (permalink)
Lines 77
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1407871797 news.xs4all.nl 2875 [2001:888:2000:d::a6]:44099
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:76146

Show key headers only | View raw


On 8/12/2014 2:20 PM, Rustom Mody wrote:
> On Tuesday, August 12, 2014 11:10:48 PM UTC+5:30, Neil D. Cerutti wrote:
>> Beginners are particularly poor, in relation to experts, at noticing the
>> applicability of idea, and at combining ideas together. Breaking things
>> into component parts has multiple benefits:
>
>> 1. The applicability of individual ideas becomes obvious. It's one thing
>> to know about [].sort, and another thing to know when it's appropriate
>> to sort something.
>
>> 2. The expert specifically shows how and why the ideas are combined.
>> This helps build the connection for the beginner, whose knowledge is not
>> stored as an expert stores it; i.e, in broad categories with multiple
>> connections; but as disorganized data with very few connections.
>
> Nice!
>
> And how do we lead the beginners towards expertise?
> In a way functional programming is to programming creativity
> what lego is to children's spatial creativity.
>
> Specifically there are a bunch of pieces that need to fit:
>
> 1. Functional Programming: Nothing more than composing functions
>     [Maybe a bit simplistic but not unrealistic a defn]
> 2. Trying this out at the interpreter
> 3. Introspectable objects

Functional programming could be particularly hard to teach since it is 
generally made up of numerous small units of work combined in a complex 
way. This is precisely the formula for something that beginners will 
find extremely challenging.

When functional programming is dumbed down enough for a beginner to be 
able to grok it, the programming problems start to look really lame. It 
needn't be that way, of course, but it takes a good deal of creativity 
on the part of the instructor. If Factorial doesn't turn you on, you 
might be screwed. ;)

> Some things follow from this:
>
> For the lego-game of playing with functions at the REPL to work and be
> pleasant and rewarding:
>
> 1. functions should be non side-effecting; else same trials giving different
> answers adds more confusion than understanding
> 2. They should be non-printing else:
>
> def foo(x): return x+1
> def bar(x): print x+1
>
> look similar when trivially tried but compositionally are utterly different
>
> In effect a printing function breaks the lego bricks

That may be so, but printing stuff to the screen is very natural to 
people. I've downloaded Haskell a few times, but the knowledge that 
getting input and writing output requires something mysterious called 
gonads just frightens me.

> [The P in the REPL is DRY enough that it does not usually need to be
> repeated all over]

A good REPL does help a lot, though.

> 3. Abstractions (class instances) should be avoided in favor of
> concrete data (lists, dicts, scalars) because they add undue mess at little
> comprehension advantage. eg take the example of a regex match. It
> returns some object and then we have to scratch our heads wondering
> whats in the magic box. If instead of match, we use findall, the data
> is manifest and obvious.

I'm with you on regex: match objects suck. That and escaping.

-- 
Neil Cerutti

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: how to get the ordinal number in list luofeiyu <elearn2014@gmail.com> - 2014-08-09 10:35 -0700
  Re: how to get the ordinal number in list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-09 13:06 +1000
    Re: how to get the ordinal number in list Rustom Mody <rustompmody@gmail.com> - 2014-08-08 20:48 -0700
      Re: how to get the ordinal number in list Roy Smith <roy@panix.com> - 2014-08-09 11:34 -0400
        Re: how to get the ordinal number in list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-10 09:43 +1000
        Re: how to get the ordinal number in list Rustom Mody <rustompmody@gmail.com> - 2014-08-10 09:28 -0700
          Re: how to get the ordinal number in list Roy Smith <roy@panix.com> - 2014-08-10 13:10 -0400
            Re: how to get the ordinal number in list Rustom Mody <rustompmody@gmail.com> - 2014-08-10 10:34 -0700
              Re: how to get the ordinal number in list Roy Smith <roy@panix.com> - 2014-08-10 14:14 -0400
                Re: how to get the ordinal number in list Rustom Mody <rustompmody@gmail.com> - 2014-08-10 11:26 -0700
                Re: how to get the ordinal number in list Chris Angelico <rosuav@gmail.com> - 2014-08-11 05:03 +1000
                Re: how to get the ordinal number in list Marko Rauhamaa <marko@pacujo.net> - 2014-08-10 22:14 +0300
                Re: how to get the ordinal number in list Chris Angelico <rosuav@gmail.com> - 2014-08-11 05:20 +1000
                Re: how to get the ordinal number in list Rustom Mody <rustompmody@gmail.com> - 2014-08-10 22:23 -0700
                Re: how to get the ordinal number in list Chris Angelico <rosuav@gmail.com> - 2014-08-11 15:46 +1000
                Re: how to get the ordinal number in list Rustom Mody <rustompmody@gmail.com> - 2014-08-10 23:22 -0700
                Re: how to get the ordinal number in list Steven D'Aprano <steve@pearwood.info> - 2014-08-11 08:55 +0000
                Re: how to get the ordinal number in list Chris Angelico <rosuav@gmail.com> - 2014-08-11 19:15 +1000
                Re: how to get the ordinal number in list Marko Rauhamaa <marko@pacujo.net> - 2014-08-11 12:35 +0300
                Re: how to get the ordinal number in list Chris Angelico <rosuav@gmail.com> - 2014-08-11 19:51 +1000
                Re: how to get the ordinal number in list Marko Rauhamaa <marko@pacujo.net> - 2014-08-11 13:46 +0300
                Re: how to get the ordinal number in list Chris Angelico <rosuav@gmail.com> - 2014-08-11 21:06 +1000
                Re: how to get the ordinal number in list Steven D'Aprano <steve@pearwood.info> - 2014-08-11 09:44 +0000
                Re: how to get the ordinal number in list Chris Angelico <rosuav@gmail.com> - 2014-08-11 19:53 +1000
                Re: how to get the ordinal number in list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-11 21:30 +1000
                Re: how to get the ordinal number in list Chris Angelico <rosuav@gmail.com> - 2014-08-11 20:07 +1000
                Re: how to get the ordinal number in list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-13 10:47 +1000
                Re: how to get the ordinal number in list Chris Angelico <rosuav@gmail.com> - 2014-08-13 11:31 +1000
                Re: how to get the ordinal number in list Roy Smith <roy@panix.com> - 2014-08-12 21:45 -0400
                Re: how to get the ordinal number in list Chris Angelico <rosuav@gmail.com> - 2014-08-13 12:06 +1000
                Re: how to get the ordinal number in list Roy Smith <roy@panix.com> - 2014-08-11 07:55 -0400
                Re: how to get the ordinal number in list Tim Chase <python.list@tim.thechases.com> - 2014-08-11 07:30 -0500
                Re: how to get the ordinal number in list Marko Rauhamaa <marko@pacujo.net> - 2014-08-11 15:41 +0300
                Re: how to get the ordinal number in list Chris Angelico <rosuav@gmail.com> - 2014-08-11 22:53 +1000
                Re: how to get the ordinal number in list Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-11 14:57 +0100
                Re: how to get the ordinal number in list Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-10 21:32 +0100
                Re: how to get the ordinal number in list Roy Smith <roy@panix.com> - 2014-08-10 18:01 -0400
                Re: how to get the ordinal number in list Chris Angelico <rosuav@gmail.com> - 2014-08-11 08:43 +1000
                Re: how to get the ordinal number in list Rustom Mody <rustompmody@gmail.com> - 2014-08-10 20:35 -0700
                Re: how to get the ordinal number in list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-11 12:04 +1000
                Re: how to get the ordinal number in list Robert Kern <robert.kern@gmail.com> - 2014-08-11 12:56 +0100
                Re: how to get the ordinal number in list Rustom Mody <rustompmody@gmail.com> - 2014-08-11 05:11 -0700
                Re: how to get the ordinal number in list Chris Angelico <rosuav@gmail.com> - 2014-08-11 22:45 +1000
                Re: how to get the ordinal number in list Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-11 15:01 +0100
                Re: how to get the ordinal number in list alister <alister.nospam.ware@ntlworld.com> - 2014-08-11 12:30 +0000
                Re: how to get the ordinal number in list Marko Rauhamaa <marko@pacujo.net> - 2014-08-11 15:41 +0300
                Re: how to get the ordinal number in list Robin Becker <robin@reportlab.com> - 2014-08-11 15:32 +0100
                Re: how to get the ordinal number in list Terry Reedy <tjreedy@udel.edu> - 2014-08-11 18:01 -0400
                Re: how to get the ordinal number in list Chris Angelico <rosuav@gmail.com> - 2014-08-12 09:27 +1000
                Re: how to get the ordinal number in list wxjmfauth@gmail.com - 2014-08-12 00:21 -0700
                Re: how to get the ordinal number in list alister <alister.nospam.ware@ntlworld.com> - 2014-08-12 10:40 +0000
                Re: how to get the ordinal number in list Chris Angelico <rosuav@gmail.com> - 2014-08-12 23:39 +1000
                Re: how to get the ordinal number in list alister <alister.nospam.ware@ntlworld.com> - 2014-08-12 18:45 +0000
                Re: how to get the ordinal number in list Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-12 20:16 +0100
                Re: how to get the ordinal number in list "Neil D. Cerutti" <neilc@norwich.edu> - 2014-08-12 13:40 -0400
                Re: how to get the ordinal number in list Rustom Mody <rustompmody@gmail.com> - 2014-08-12 11:20 -0700
                Re: how to get the ordinal number in list "Neil D. Cerutti" <neilc@norwich.edu> - 2014-08-12 15:29 -0400
                Re: how to get the ordinal number in list Rustom Mody <rustompmody@gmail.com> - 2014-08-12 20:49 -0700
                Re: how to get the ordinal number in list Terry Reedy <tjreedy@udel.edu> - 2014-08-12 18:01 -0400
              Re: how to get the ordinal number in list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-11 13:00 +1000
                Re: how to get the ordinal number in list Rustom Mody <rustompmody@gmail.com> - 2014-08-10 21:29 -0700
                Re: how to get the ordinal number in list Steven D'Aprano <steve@pearwood.info> - 2014-08-11 10:28 +0000
                Re: how to get the ordinal number in list Rustom Mody <rustompmody@gmail.com> - 2014-08-11 04:49 -0700
                Re: how to get the ordinal number in list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-13 12:11 +1000
                Re: how to get the ordinal number in list Chris Angelico <rosuav@gmail.com> - 2014-08-13 12:18 +1000
                Re: how to get the ordinal number in list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-13 13:11 +1000
          Re: how to get the ordinal number in list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-11 03:17 +1000

csiph-web