[CentralOH] 2015-05-22 道場 Scribbles 落書/惡文? unpacking sets; raw string flaw; one hand clapping rodeo panera lemon pi sushi turing test hinting class example kali backtrack scapy toehead violent python

jep200404 at columbus.rr.com jep200404 at columbus.rr.com
Sat May 23 23:30:29 CEST 2015


unpacking works on sets in addition to the usual suspects.
this surprised me a little bit

    sensei at dojo:~$ python
    Python 2.7.6 (default, Mar 22 2014, 22:59:38) 
    [GCC 4.8.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> a, b, c = {3, 5, 8}
    >>> b
    3
    >>> a, b, c = {3: 9, 5: 25, 8: 64}
    >>> b
    3
    >>> a, b, c = [3, 5, 8]
    >>> b
    5
    >>> a, b, c = (3, 5, 8)
    >>> b
    5
    >>> a, b, c = '358'
    >>> b
    '5'
    >>> 
    sensei at dojo:~$ 

raw strings are not quite raw
this surprised an MS Windows user much
    
    sensei at dojo:~$ python
    Python 2.7.6 (default, Mar 22 2014, 22:59:38) 
    [GCC 4.8.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> s = r'c:\blah\'
      File "<stdin>", line 1
        s = r'c:\blah\'
                      ^
    SyntaxError: EOL while scanning string literal
    >>> 
    sensei at dojo:~$ 

    https://mail.python.org/pipermail/centraloh/2015-January/002310.html

The sound of one hand clapping.

    sensei at dojo:~/20150522$ python
    Python 2.7.6 (default, Mar 22 2014, 22:59:38) 
    [GCC 4.8.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> a = ['hello'] # a is a list
    >>> a
    ['hello']
    >>> a, = ['hello'] # a is a string
    >>> a
    'hello'
    >>> 
    sensei at dojo:~/20150522$ 

wp: prefix means Wikipedia
To get good answers, consider following the advice in the links below.
http://catb.org/~esr/faqs/smart-questions.html
http://web.archive.org/web/20090627155454/www.greenend.org.uk/rjk/2000/06/14/quoting.html

9 folks - Are we outgrowing Panera?

turing test in media
http://dilbert.com/strip/2015-05-22
wp:The Imitation Game

wp:Jiro Dreams of Sushi

batch file
powershell
bash
cygwin

http://www.itrunsonlinux.com/hardware/lemon-pi-a-powerful-raspberry-pi-clone/

https://en.wikipedia.org/wiki/Moto_G_(1st_generation)
https://en.wikipedia.org/wiki/Republic_Wireless
http://www.bestbuy.com/site/boost-mobile-motorola-moto-g-no-contract-cell-phone-black/3135008.p?id=1219088033418&skuId=3135008
http://www.bestbuy.com/site/motorola-moto-g-2nd-generation-cell-phone-unlocked-u-s-version-black/9055007.p?id=1219387046337&skuId=9055007
http://www.bestbuy.com/site/motorola-moto-g-2nd-generation-cell-phone-unlocked-u-s-version-black/9055007.p?id=1219387046337&skuId=9055007
http://www.bestbuy.com/site/verizon-wireless-prepaid-motorola-moto-g-no-contract-cell-phone-black/3041063.p?id=1219086346405&skuId=3041063

rodeo an ide for data analysis in python (cloned R studio)
https://pypi.python.org/pypi/rodeo

http://www.zdnet.com/article/mark-shuttleworth-considering-canonical-ipo/

http://www.heinleinsociety.org/rah/thisibelieve.html

All problems become software problems.

http://learnxinyminutes.com/

[Distutils] Released: pip 7.0 and virtualenv 13.0
https://mail.python.org/pipermail/distutils-sig/2015-May/026474.html

Python 3.5 type hinting
https://www.python.org/dev/peps/pep-0484/

wp:Kali Linux
wp:BackTrack

Lemon Pi
http://www.itrunsonlinux.com/hardware/lemon-pi-a-powerful-raspberry-pi-clone/
http://tuxmachines.org/node/76251

https://dgillart.wordpress.com/tag/toeheads/
https://www.facebook.com/MOUTONonHigh?_fb_noscript=1

violent python
scapy
https://pypi.python.org/pypi/scapy
wp:Talk to the hand

http://english.chosun.com/site/data/html_dir/2015/05/22/2015052201633.html

    ==> stupid_class_example.py <==
    from __future__ import print_function

    class Player():
        def __init__(self, name, average):
            self.name = name
            self.average = average

        def __str__(self):
            return 'Player name: %s average: %s' % (self.name, self.average)

    class Team():
        def __init__(self, players):
            self.players = players

        def max_average(self):
            # return max(player.average for player in self.players)
            highest_average = 0.0
            for player in self.players:
                if player.average > highest_average:
                    highest_average = player.average
            return highest_average

        def __str__(self):
            return ', '.join([str(player) for player in self.players])
        
    f = Player('Bob', .234)
    g = Player('Joe', .345)
    t = Team([f, g])

    print(f)
    print(t)
    print(t.max_average())


More information about the CentralOH mailing list