GithubHelp home page GithubHelp logo

sjord01 / explore-python-fundamentals-part-1-manning-liveproject Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 71 KB

The series of projects work out Python skills and form sound mental models of fundamental aspects of Python.

Jupyter Notebook 100.00%
python python3

explore-python-fundamentals-part-1-manning-liveproject's Introduction

Explore Python Fundamentals-Part 1: Manning-LiveProject

The series of projects work out Python skills and form sound mental models of fundamental aspects of Python.

Project 1: Variables

1.1. Explore the Problem with Immutable vs. Mutable Objects

  • Explore the characteristics of Python variables by examining what happens when re-assigning a value or changing an element/s in lists or arrays.

1.2. Test Hypotheses - Are Variables Containers or Labels

  • Python's built-in function id() returns an object’s integer identifier; it helps in understanding the nature of Python variables and debugging codes,

Project 2: Objects & Methods

2.1 Creating class using the 'type()' function

  • Aside from Python's conventional way of constructing class objects, the 'type()' function offers an alternative of creating dynamic classes.

2.2 Exploring Objects and Instance Methods

  • In object-oriented programming, a class is a custom-designed plan or model that serves as a basis for generating objects. Classes allow for the combination of data and functionality into a single entity. When a new class is established, it produces a new kind of object, enabling the creation of new instances of that type. Each instance of a class can possess properties that are associated with it to keep track of its condition. Furthermore, class instances can possess methods (specified by their class) for altering their state.

Project 3: Class Methods & Variable

3.1 Class Data

  • Explore about classes, attributes, and methods in Python, and how they can be used to define and manipulate objects in an OOP context.
  • Leverage the benefit of using a mutable object (a list) as an attribute, instead of a scalar value, to keep track of data across multiple instances of a class.

3.2 Class Method

  • Scripting a Python code of classes should take into considerations what the program is about and its main purpose, its readability and maintainability, the possibility of it being scaled up in the future; these principle set the way of your class data will be accessed.
  • If you need to access class-level data from within an instance, the class property or @classmethod decorator might be the best choice. If you only need to access class-level data from outside the class, using the class itself might be the simplest and most efficient approach.

Project 4: Inheritance

4.1 Inheriting from Another Class

  • Implementing proper inheritance in Python through creating a more organized and maintainable codebase by avoiding code duplication and reusing code from parent classes in our subclasses.

4.2 Inheriting from More than One Class at Once - Mixins

  • The code and examples demonstrate how mixins can be used to create reusable functionality that can be easily combined with other classes to create new classes with different behaviors. By separating the functionality into mixins, we can avoid repeating code and simplify the class hierarchy.

Project 5: Iteration

5.1 Iteration Protocol and Creating an Iterable

  • Custom iterables and iterators can be created in Python by implementing the appropriate methods and protocols. Overall, iteration is a powerful and flexible concept in Python, and it's used extensively throughout the language and its standard library. With a good understanding of how iteration works in Python, you can easily create and work with a wide variety of iterable sequences and iterators.

5.2 Creating an Iterator and Using a Generator Function

  • When working with iterators and generators, it's important to be aware of the differences between the two approaches, and to choose the one that best fits your needs. If you need fine-grained control over the iteration process, or if you need to implement complex stateful behavior, then iterators may be the better choice. If you need a simple way to produce a sequence of values, or if you need to produce a very large sequence that won't fit in memory, then generators may be the better choice.

  • Iterators and generators work in conjunction with for loops and can be used to create custom iterator and generator classes and functions. Overall, iterators and generators are powerful tools for working with sequences of values in Python, and can be used in a wide variety of applications.

explore-python-fundamentals-part-1-manning-liveproject's People

Contributors

sjord01 avatar

Watchers

 avatar

Forkers

skpanigrahy

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.