Who uses IDLE -- please answer if you ever do, know, or teach

Friedrich Rentsch anthra.norell at bluewin.ch
Fri Aug 7 03:22:04 EDT 2015



On 08/06/2015 03:21 AM, Rustom Mody wrote:
> On Thursday, August 6, 2015 at 6:36:56 AM UTC+5:30, Terry Reedy wrote:
>> There have been discussions, such as today on Idle-sig , about who uses
>> Idle and who we should design it for.  If you use Idle in any way, or
>> know of or teach classes using Idle, please answer as many of the
>> questions below as you are willing, and as are appropriate
>>
>> Private answers are welcome. They will be deleted as soon as they are
>> tallied (without names).
>>
>> I realized that this list is a biased sample of the universe of people
>> who have studied Python at least, say, a month.  But biased data should
>> be better than my current vague impressions.
>>
>> 0. Classes where Idle is used:
>> Where?
>> Level?
>>
>> Idle users:
>>
>> 1. Are you
>> grade school (1=12)?
>> undergraduate (Freshman-Senior)?
>> post-graduate (from whatever)?
>>
>> 2. Are you
>> beginner (1st class, maybe 2nd depending on intensity of first)?
>> post-beginner?
>>
>> 3. With respect to programming, are you
>> amateur (unpaid)
>> professional (paid for programming)
>>
>> -- 
>> Terry Jan Reedy, Idle maintainer
> I used idle to teach a 2nd year engineering course last sem
> It was a more pleasant experience than I expected
> One feature that would help teachers:
> It would be nice to (have setting to) auto-save the interaction window
> [Yeah I tried to see if I could do it by hand but could not find where]
> Useful for giving as handouts of the class
> So students rest easy and dont need to take 'literal' notes of the session
>
> I will now be teaching more advanced students and switching back to emacs
> -- python, C, and others -- so really no option to emacs.
> Not ideal at all but nothing else remotely comparable

I've been using Idle full time to simultaneously manage my financial 
holdings, develop the management system and manually fix errors. While 
the ultimate goal is a push-button system, I have not reached that stage 
and am compelled to work trial-and-error style. For this way of working 
I found Idle well-suited, since the majority of jobs I do are hacks and 
quick fixes, not production runs running reliably.

I recently came up with a data transformation framework that greatly 
expedites interactive development. It is based on transformer objects 
that wrap a transformation function. The base class Transformer handles 
the flow of the data in a manner that allows linking the transformer 
modules together in chains. With a toolbox of often used standards, a 
great variety of transformation tasks can be accomplished by simply 
lining up a bunch of toolbox transformers in chains. Bridging a gap now 
and then is a relatively simple matter of writing a transformation 
function that converts the output format upstream of the gap to the 
required input format downstream of the gap.

The system works very well. It saves me a lot of time. I am currently 
writing a manual with the intention to upload it for comment and also to 
upload the system, if the comments are not too discouraging. If I may 
show a few examples below . . .

Frederic (moderately knowledgeable non-professional)

------------------------------------------------------

    >>> import TYX

    >>> FR = TYX.File_Reader ()
    >>> CSVP = TYX.CSV_Parser ()
    >>> TAB = TYX.Tabulator ()

    >>> print TAB (CSVP (FR ('Downloads/xyz.csv')))   # Calls nest
    -------------------------------------------
    Date,Open,Close,High,Low,Volume
    07/18/2014,34.36,34.25,34.36,34.25,485
    07/17/2014,34.55,34.50,34.55,34.47,"2,415"
    07/16/2014,34.65,34.63,34.68,34.52,"83,477"
    -------------------------------------------

    >>> CSVP.get ()   # display all parameters
    CSV_Parser
     dialect      > None
     delimiter    > '\t'
     quote        > '"'
     has_header   > False
     strip_fields > True
     headers      > []

    >>> CSVP.set (delimiter = ',')
    >>> TAB.set (table_format = 'pipe')
    >>> print TAB (CSVP ())   # Transformers retain their input
    |:-----------|:------|:------|:------|:------|:-------|
    | Date       | Open  | Close | High  | Low   | Volume |
    | 07/18/2014 | 34.36 | 34.25 | 34.36 | 34.25 | 485    |
    | 07/17/2014 | 34.55 | 34.50 | 34.55 | 34.47 | 2,415  |
    | 07/16/2014 | 34.65 | 34.63 | 34.68 | 34.52 | 83,477 |

    >>> class formatter (TYX.Transformer):
           def __init__ (self):
              TYX.Transformer.__init__ (self, symbol = None) # declare 
parameter
           def transform (self, records):
              symbol = self.get ('symbol')
              if symbol:
                 out = []
                 for d, o, c, h, l, v in records [1:]: # Clip headers
                    month, day, year = d.split ('/')
                    d = '%s-%s-%s' % (year, month, day)
                    v = v.replace (',', '')
                    out.append ((d, symbol, o, c, h, l, v))
                 return out
    >>> fo = formatter ()
    >>> fo.set (symbol = 'XYZ')
    >>> TAB.set (float_format = 'f')
    >>> print TAB (fo (CSVP()))   # Transformers also retain their output
|:-----------|:----|----------:|----------:|----------:|----------:|------:|
    | 2014-07-18 | XYZ | 34.360000 | 34.250000 | 34.360000 | 34.250000 
|   485 |
    | 2014-07-17 | XYZ | 34.550000 | 34.500000 | 34.550000 | 34.470000 
|  2415 |
    | 2014-07-16 | XYZ | 34.650000 | 34.630000 | 34.680000 | 34.520000 | 
83477 |

    >>> DBW = TYX.MySQL_Writer (DB, USER, PASSWORD, table_name = 'quotes')
    >>> DBW (fo ())
    0

    0 means it worked

    >>> Q2DB = Chain (FR, CSVP, fo, DBW)
    >>> TL = TYX.Text_To_Lines ()
    >>> SR = TYX.System_Read ()
    >>> for file_name in TL (SR ('ls -1 ~/Downloads/*.csv')):
           symbol = file_name.rsplit ('/', 1)[1].split ('.')[0].upper ()
           print symbol
           Q2DB.set (symbol = symbol, file_name = file_name)
           Q2DB ()
    ABC
    0
    DEF
    0
    . . .

    End of hacking. The production Transformer is next.

    >>> class Quotes_CSV_To_DB (TYX.Chain):
           def __init__ (self):
              TYX.Chain.__init__ (
                  self,
                  TYX.File_Reader (),
                  TYX.CSV_Parser (delimiter = ','),
                  formatter (),
                  TYX.MySQL_Writer (DB, USER, PASSWORD, table_name = 
'quotes')
               )
    >>> Q2DB = Quotes_CSV_To_DB ()
    >>> for file_name in TL (SR ('ls -1 ~/Downloads/*.csv')):
           . . .

    >>> Q2DB.get ()  # display all parameters
    ==============================================
    Q2DB
     symbol = 'QQQ'
     file_name = '/home/fr/Downloads/qqq.csv'
    ==============================================
         File_Reader
          file_name > '/home/fr/Downloads/qqq.csv'
    ----------------------------------------------
         CSV_Parser
          dialect      > None
          delimiter    > ','
          headers      > []
          quote        > '"'
          strip_fields > True
          has_header   > False
    ----------------------------------------------
         formatter
          symbol  > QQQ
    ----------------------------------------------
         MySQL_Writer
          db_name    > 'fr'
          table_name > 'quotes'
          user       > 'fr'
          permit     > 2
          password   > None
    ----------------------------------------------
    ==============================================


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150807/29e1f3c9/attachment.html>


More information about the Python-list mailing list