Hello,
Please find the minutes of October 2016 Chennaipy Meetup
Dictionary
Dictionaries are actually lists with keys as index. A dictionary internally is
a hash table (in the memory) and has an Index, hash, key, value.
Initially there are fixed slots assigned to a dictionary hash table (starts
with 8). A hash function returns integer which is passed to a bits function to
get index of slot.
Collision occurs when a two distinct keys get the same hash. There are back up
slots to avoid collisions and this is done with the help of a pseudo random
probing algorithm. The order of insertion gets changed while retrieving in
dictionaries because of collisions. Reading value also uses pseudo random
algorithm to prevent collision.
Deleting a key will replace with a dummy key. This is to help in collisions.
Since inserting key changes order, python doesn't allow inserting during
iteration.
The Probing algorithm is optimised and super fast and it trades spaces (memory)
for speed. So If there is a need to conserve space, use tuple.
We can’t use mutable keys since python uses hashes for keys and changing the
key will break the hash.
Modules
Any python source file is a module. To check where a module resides, use
inspect.getfile. All the statements in a module get executed from top to bottom.
Packages are used to organise large number of modules in a systematic manner.
The command import * brings all but it is not a good practice as it pollutes
the namespace. We need to be consistent with import style. There is no
improvement in performance on importing whole file or only one function in a
module.
Naming rules: Don't start with integer, don't use system package names, no non
ASCII chars in file names.
The import command searches from directories present in sys.path. The modules
get imported only once. To force reload a module you can use "from importlib
import reload”. This is not recommended in production code.
Use explicit relative imports (from . Import foo) to minimise breaking on
package name change. The init.py file brings submodules into a package
Testing
Selenium is a browser automation tool. It makes cross browser testing easy.
Saves a lot! The main components are ide, RC, web driver /selenium 2, grid
Lightning Talks
Mind map experience with python and advantages of elpy (saves a lot of time).
Talks on whether Indian software industry will die or not, talent pyramid, the
need to stay relevant and focus on disruptive technologies like data sciences.
Python fits everywhere.
Kind regards,
Bharath
Testpress
_______________________________________________
Chennaipy mailing list
Chennaipy@python.org
https://mail.python.org/mailman/listinfo/chennaipy