Code Monkey home page Code Monkey logo

dive-into-python3's Introduction

RSVP NOW

Please help to confirm your attendance by completing this form. We will only share the meeting link with confirmed attendees.

Deadline to RSVP: Thursday, 28th June 2020 23:59.

forthebadge
forthebadge made-with-python
forthebadge


Dive Into Python 3

"Don’t bury your burden in saintly silence. You have a problem? Great. Rejoice, dive in, and investigate." β€” Ven. Henepola Gunaratana

Next Session, Friday, 12TH JUNE 2020 19:00 - 20:00

Perhaps you are new to Python? Perhaps a snake is the only Python you know? Or, perhaps you are a seasoned Python magician? If you are willing, we would be overjoyed to stride ahead with you.

In our next session:

  • Topic: Dive into Python Classes & Iterators
  • Speaker: Kalebu Jordan
  • Moderator: Chrisostom Kaweza
  • Location: Online

RSVP NOW

Please help to confirm your attendance by completing this form. We will only share the meeting link with confirmed attendees.

Deadline to RSVP: Thursday, 28th June 2020 23:59.

Last Session, Friday, 29th June 2020 19:00 - 20:00

If perhaps you missed our last session, and are wondering how you can come up to speed, we've prepared a nice recap (link below) for your reading pleasure.

Interview with Kalebu Jordan: Diving Into Python 3

If you manage to read it, we would love to hear your thoughts and feedback. We will appreciate if you tweet your them and tag @forLoopTanzania.

If you happen to know someone that will benefit from this, please don't hesitate to share with it them. We will appreciate the love.

dive-into-python3's People

Contributors

joshuamabina avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dive-into-python3's Issues

Chapter 6: Closures & Generators

Closures:

According to google a closure is an act or process of closing something, especially an institution, thoroughfare, or frontier, or of being closed

In python, A closure is an inner function that remembers and has access to variables of the local scope which was created, even after the outer function has finished executing.

hint: A closure closes over free variables from their environment.

Discussion Points:

  • Use of regular expression in a closure

  • A list of functions

  • A list of patterns

  • A file of patterns

Generators:

There is a lot of work in building an iterator in Python. We have to implement a class with iter() and next() method, keep track of internal states and raise StopIteration when there are no values to be returned.

This is both lengthy and counterintuitive. This is when generators dive in

Python generators are way of creating iterators

Discussion points:

  • A Fibonacci Generator

  • A Plural Rule Generator

Hint: We use generators over other loops for mainly two reasons:

  • more performance

  • Easy to read and write

I know you argue with list compressions that are also easy to write right?...YES but the good of generators is you can use them with list comprehension and get performance as a bonus too

Chapter 1: Your First Python Program

Hi there,

Writing this with hope it finds you well and keeping safe during these unprecedented times of the COVID19 pandemic.

Regarding the subject:

I like to think that I am huge JavaScript fanatic. Frankly, I am one of those chaps who feel the urge to do everything in JS, even if I don't really have to πŸ˜‚

To some good stuff, for the up-and-coming weeks, join us as we explore what it takes to #DiveIntoPython based on the book, "Dive Into Python, by Mark Pilgrim". FYI, the goal of this first event, is to discuss the general idea of the book, and extract some insights from the very first three (3) chapters.

All of that being said, I am very excited and can not wait to see you all. For your viewing pleasure, the event details following below.

--

Event Details:

  • When: 2020-05-24, 19:00 - 21:00 HRS EAT
  • Who: Come one, come all.
  • Where: Online

Discussion Points:

  1. About the Book. Is it hot or not?
  2. History and Chemistry. Is it a big snake?
  3. What's New in Python 3? Briefly, why?
  4. First Impressions. First-time good/bad/ugly impressions with Python?
  5. Diving In. Coding our first Python program.
  6. Everything is an Object. Everything.
  7. Exceptions Whoops! Something went wrong.
  8. Picks Tools, library, framework, people, podcasts, books, coffee e.t.c.

Important Links

Chapter 13: Serializing Python Objects

Do you think serializing data structures is simple? Please, think again!

Spoilers...

import pickle, json

# make serializing data, great again!

See source: https://diveintopython3.net/serializing.html


Review Questions

  1. What can you Pickle?
  2. The pickle module takes a Python data structure and saves it to a file. Discuss the caveats.
  3. Not every Python data structure can be serialized by the pickle module. Discuss why.
  4. Demonstrate saving data to a pickle file.
  5. Demonstrate loading data from a pickle file
  6. Demonstrate pickling without a file
  7. Demonstrate how one can use pickletools to debug a pickle file
  8. Demonstrate, data serialization for each python-specific datatypes to JSON

Chapter 10: Refactoring

Refactoring:
Refactoring is the process of updating existing code while functionally remain the same. There are a variety of reasons for refactoring code including performance, readability, and future scalability.

Hint: Refactoring does not only get it done but get it done correctly.

Focus:
Refactoring in unit testing.

Chapter 5: Regular Expressions

Regular expression or regex - we use them but don't love them! 😬 πŸ˜†

According to Wikipedia, regular expressions are:

A sequence of characters that define a search pattern.

If Wikipedia is not enough you, check out grep.

Everyone knows grep. Its reputation precedes it. Maybe the most of us don't care for how it works, but we love it because, it just works.

With that said, the following is a deep-dive into Regular Expressions using Python. The aim of this issue is for us to better understand how grep works. Enjoy!

--

Discussion Points

  • Case Study: Street Addresses
  • Case Study: Roman Numerals
  • Using the {n,m} Syntax
  • Case Study: Parsing Phone Numbers

Chapter 9: Unit Testing

Unit Testing is the first level of software testing where the smallest testable parts of a software are tested. This is used to validate that each unit of the software performs as designed. The unittest test framework is python's xUnit style framework.

Source: https://diveintopython3.net/unit-testing.html


Review Questions

  1. What is Test-Driven Development (TDD)?
  2. Why does Test-Driven Development matter?
  3. What is Unit Testing?
  4. Why does Unit Testing matter?
  5. How does Test-Driven Development differ from Unit Testing?
  6. Not every automated test is a unit test. Discuss.
  7. What makes a unit test good or bad?
  8. It is not enough to test for success. Discuss.
  9. Apart from unittest, are there any other Pythonic unit testing libraries we can leverage?

Chapter 14: HTTP Web Services

Philosophically, I can describe HTTP web services in 12 words: exchanging data with remote servers using nothing but the operations of HTTP. - Mark Pilgrim

Source: https://diveintopython3.net/http-web-services.html


Review Questions

  1. In the words of the author, 304: Not Modified means *"same shit, different day." (a) Discuss what he means (b) Describe when the statement does not apply.

  2. There are five (5) features that all HTTP clients should support. Briefly, help to describe.

  3. Mark so boldly suggests that httplib2 is better than urllib. Expand based on guidelines below:

    1. Like urllib, httplib2 also returns bytes, not strings. Why?
    2. How does caching work on httplib2?
    3. How does httplib2 handle Last-Modified and ETag headers?
    4. How does httplib2 handle compression?
    5. How does httplib2 handle redirects?

External References

  1. https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching
  2. https://web.dev/http-cache/
  3. https://stackoverflow.com/questions/3586295/does-urllib2-urlopen-cache-stuff
  4. https://www.mnot.net/cache_docs/
  5. https://github.com/httplib2/httplib2/wiki/Examples-Python3

Create assets

Create some basic assets to get the ball rolling.

  • Create banner images for social
  • Create banner images (black_white color scheme) for social #TBT
  • Create speaker starter kit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.