[CentralOH] 2014-11-28 道場 Scribbles 落書/惡文?: 12doc, dictionaries, hashing, git, divmod, style

jep200404 at columbus.rr.com jep200404 at columbus.rr.com
Sat Nov 29 17:38:24 CET 2014


http://nbviewer.ipython.org/url/colug.net/python/dojo/20141128/dojo-20141128.ipynb

We had the place to ourselves, so Wifi was better than usual.

wp:Ubuntu Touch
wp:BeagleBone#BeagleBone_Black

https://pypi.python.org/pypi/pytz

wp:associative array

One person was confused by looking behind the curtain with Zed's implementation
of a toy dictionary in hashmap.py. Hopefully Brandon's video will unconfuse
them. Understanding how hashing works and how important it is was confusing.
Dictionaries can be implemented with uses hashes, but there are tremendous
benefits to using hashes for dictionaries. 
wp:Hash function
wp:Hash table
    hash tables can be used to make dictionaries efficiently use memory and time.

The Mighty Dictionary (#55)
http://pyvideo.org/video/276/the-mighty-dictionary-55

http://learnpythonthehardway.org/book/ex39.html
    Should some functions such as hashkey() be private?

What you need to know about datetimes (they are a mess!)
http://pyvideo.org/video/946/what-you-need-to-know-about-datetimes

Better dates and times for Python
https://pypi.python.org/pypi/arrow

A dozen dozens is really gross.
wp:Gross (unit)

>>> seconds = 881812
>>> minutes, second = divmod(s, 60)
>>> minutes, second
(14696, 52)
>>> hours, minutes = divmod(minutes, 60)
>>> hours, minutes
(244, 56)
>>> days, hours = divmod(hours, 24)
>>> days, hours
(10, 4)
>>> 

days, hours, minutes, seconds = foo(seconds, 60, 60, 24)
days, hours, minutes, seconds = foo(seconds, 24, 60, 60)
days, hours, minutes, seconds = foo(seconds, (24, 60, 60))
days, hours, minutes, seconds = foo(24, 60, 60, seconds)
write foo
write foo to handle arbitrary number of divisor arguments
    Easier to try with just two arguments first, 
        where second argument is sequence of divisors
    Which order do you want the divisors to be in?
    What's a good name for foo?

wp:PyCharm

$ cat ~/.gitconfig 
...
[alias]
        co = checkout
        ci = commit
        st = status
        br = branch
        hist = log --pretty=format:\"%h %ad %s%d [%an]\" --graph --date=short
        hist = log --pretty=format:\"%h %ad %s%d [%an]\" --graph --date=iso
        type = cat-file -t
        dump = cat-file -p

Hashing is mighty important for git also.

Played with git cloning, merging, fetching, and pushing on command line 
without using GUI or browser tools.
git add remote mid https://github.com/JulianCienfuegos/theREALway
git add remote pybokeh https://github.com/pybokeh/theREALway
git fetch pybokeh
git fetch mid
git push origin master
git push origin myway
git push origin mid

Python3
>>> import builtins
>>> dir(builtins)
...
>>> len(dir(builtins))
131
>>> 'divmod' in dir(builtins)
True
>>> 

binary operators
|
&
^
~

| and & work on sets

wp:Jar Jar Binks
wp:Star Wars
wp:George Lucas
wp:Comparative mythology
wp:The Power of Myth
wp:Joseph Campbell
wp:Sarah Lawrence College

wp:Asimina triloba
wp:Eastern Agricultural Complex

todo

    tools

        vim
        git


import this

need to get summary of rules
http://cm.bell-labs.com/cm/cs/tpop/index.html

wp:The Elements of Style
wp:The_Elements_of_Programming_Style#Lessons
http://blog.csdn.net/cpp_chen/article/details/7199874
http://bbs.chinaunix.net/thread-104986-1-1.html
http://blog.chinaunix.net/uid-23971666-id-307968.html

Chet Atkins and Mark Knopfler - Neck and Neck
wp: prefix means wikipedia


More information about the CentralOH mailing list