Hi, Please find the MIM.
Start by the - Vijay Rangaraj : 15:20 - 15:33 ------------------------- Newbies to the python. Notes : - Python is an interpreter language - Interpreter executes line by line Problem : - Rolling the dice to get random numbers - Using import random module, to generate random numbers - Complexity here is have more dices and many faces for dice - To resolve this we can using list to hold faces for the dice - To select only the faces in the list, we can use the function from random is random.choice() giving the list as argument. - Use print to check the selection - To give wait period for the program to print the output, using import time module. Function: time.sleep(1) # here it will sleep for 1 sec - Represent the output in traditional dice way using the below: chr(rolled_value) # convert the integer into unicode value, make sure to have unicode value to be saved in the dice to show the values in dice format # suggestion : range(9856, 9856+6) to save the - Reference : https://en.wikipedia.org/wiki/Dice Dr M.Muralidharan : 15:35 - 15:51 ---------------------------------- Multithreading in Python Notes : - Python is involed in most of applications. - One of the most popular language - In all the domains, we have the modules and packages Multithreading : - Process : - is the program execution - each process has its only own data struction called PCB - heavy weight - can have child process created using fork - Thread : - light weight - sub set of the process - all the threads can be run at the same time to increase the efficiency - Modules available - Thread - spawn, manage, sync threads # deprecated - Threading - higher level, improved sync modules - Queue - Locking Mechanism - Locking and releasing is used for syncronisation purpose - Explained with examples for each Module listed above - Advantages : - better use of resources - Disadvantages : - complexity increases - debug issues - dead locks can occur - sync is cpu and memory intense - Applications : - web servers and browsers - games - text editors and IDE Jitin Joseph : 15:53 - 16:15 ------------------------------ Webscraping in Python Notes : - is a technique to fetch data and information from websites - extracting data from web pages - web crawling can be achieved by webscraping Scrapy : - Usages : - e-commerce price comparision - machine learning - Rules : - its legal based on the usage - needs to check the terms and conditions - check robot.txt - should not crawl at disruptive rate - General Steps : - get the url - validate the rules - write code to scarp the code - Challenges : - throttle limit - authentication required - ip ban - broken html or bad code - Tools : - Beautiful soup 4 - Scrapy - Example demoed - Architecture diagram of scrapy Questions : - when a URL Prompt for Captcha, do they try to limit bot login ? and will OCR can over come it ? # Ans : Need to check the rules - does robot.txt applies to all websites ? # Ans : Yes most of the websites will have it - is there any other page or method to identify the dsiallowed url ? # Ans : Only robots.txt Narendra Sridharan : 16:15 - 16:30 ----------------------------------- Surprising fact of Programming in Python Notes : - Newbie encounter surprises about python Jupyter : - Using Jupyter from anaconda - Export .pyinb into .py - Export into ppt also Surprises : - syntatic sugars - not brackets only indentation - no semicolons - for loops are completly different - negative indexing - no switch case - multiple assignments - functional programming - lambdas, genertors - concurrent programming - co-routines - async programming - aspect object programming - Questions : - negative indexing - for last part of the filenames from path - os.path.basename() # get the basename - a=[0,1,2,3,4] a[-1]=4 Vijay : 16:30 - 16:48 ---------------------- Threads, Locking and The GIL Notes : - Deeper into the locking - GIL Demo : - For Threads - have two threads running to increment a variable - changed from 100, 1000, 10000 - after 100000, the incrementer counter values gets corrupted - Why - less the < 10000 the values are not getting corrupted - Dis-assemble - did.dis(function) - to details the assembly language code - explaination of the assemble steps - load the attr - inplace_add - store_attr - Able to see the race conditions - which is causing the corruptions - To resolve this we can use Locks - Lessons Learnt - when using multi thread, we should use locks for value changes - GIL - As interpreter only one thread can be executed - When thread relases the GIL : - when the blocking system call is invoked - when more than 10000 instructions Questions : - pre-empted is under control of OS - dis is used to get python byte code generators Abhishek Mishra : 16:48 - 17:00 -------------------------------- PyConIndia - Open online this year 2020 - https://in.pycon.org/cfp/2020/proposals/ - Date : 2-5th October - CFP - submit the talks - https://pyconindia.zulipchat.com/login/ # suggestion and chat Conclusion and Thanks by Vijay. -- Regards, Selvi....
_______________________________________________ Chennaipy mailing list Chennaipy@python.org https://mail.python.org/mailman/listinfo/chennaipy