{"id":16220751,"url":"https://github.com/elc/python-tutorial","last_synced_at":"2025-03-19T11:31:07.233Z","repository":{"id":42032768,"uuid":"303211438","full_name":"ELC/python-tutorial","owner":"ELC","description":null,"archived":false,"fork":false,"pushed_at":"2023-07-07T23:40:14.000Z","size":33215,"stargazers_count":7,"open_issues_count":0,"forks_count":29,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T18:23:13.319Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ELC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-11T20:58:30.000Z","updated_at":"2025-01-20T16:57:22.000Z","dependencies_parsed_at":"2024-10-27T20:32:07.611Z","dependency_job_id":"6af26eaf-1cc9-40b4-8f2a-a1e7f7c5aa5b","html_url":"https://github.com/ELC/python-tutorial","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ELC%2Fpython-tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ELC%2Fpython-tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ELC%2Fpython-tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ELC%2Fpython-tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ELC","download_url":"https://codeload.github.com/ELC/python-tutorial/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243985955,"owners_count":20379237,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T11:59:28.435Z","updated_at":"2025-03-19T11:31:03.794Z","avatar_url":"https://github.com/ELC.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python For Programmers\n\nThis is a \"tutorial\" in a cheatsheet style for programmers who want to learn\nPython. Programming basics such as data types, control flow, object-oriented\nprogramming are assumed.\n\n## Why?\n\nIn recent years there has been a trend to incorporate different programming\nlanguages to solve different problems, this practice was usually referred to as\n[Polyglot\nProgramming](https://www.thoughtworks.com/radar/techniques/polyglot-programming).\nPython in particular has been the de facto language for Artificial Intelligence\nApplications (AI/ML/DP) for several years, with presence in other fields like QA\nautomation, Back-End Web Development, Robotic Process Automation, Command Line\nInterface development and Infrastructure. Therefore, many programmers coming\nfrom different backgrounds are and will be learning Python.\n\nHowever, Python has some distinct aspects that set it apart from most languages,\nmost notably it is indentation-based and it is interpreted. Not only that but it\nalso encourages a way to structure the code that differs substantially from\ntraditional .Net or Java styles.\n\nThis tutorial aims to show what idiomatic Python looks like, the syntax\ncan be learned fairly quickly, but Programming Python \"á la Java/.Net/Javascript\"\nshould be avoided.\n\nSome examples:\n- Java and C# use classes explicitly and extensively, but in Python, many things\n  are built so that the consumer of the code may not know that it is using\n  custom classes. Iterators, Context Managers, and Decorators are examples of\n  these patterns.\n- Many design patterns are way simpler in Python due to the feature that it has,\n  such as first-class functions and first-class Types. No need to have many\n  classes with a single method if you can pass a user-defined function as a\n  parameter (Strategy Pattern).\n- Python has no private/internal members for classes, and most members can be\n  treated as C# Properties, so getters and setters are rarely used.\n- Python natively incorporates elements from functional programming without\n  going to Javascript extremes ([callback\n  hell](https://en.wiktionary.org/wiki/callback_hell)). Mixing it with Object\n  Oriented Patterns.\n- Python types are not enforced but only used by the IDE as suggestions to throw\n  warnings.\n- Many more, but you can notice them by reading the different chapters.\n\n## Chapters\n\nThis tutorial is divided into chapters, each chapter consists of a file\ndetailing syntax and examples as well as how the outputs should look like.\n\nAll the chapters are runnable Python files when code that would throws errors\nappears, it is always commented out.\n\nThe chapters can be read as a cookbook as there are no cross-references but the\nmore complex topics assume previous chapter content was understood.\n\nThe following is a summary of each chapter.\n\n### 0. Introduction - Environment and Tips\n\nThis optional chapter shows IDE configuration, themes, fonts, and extensions\nuseful for Python developers.\n\n### 1. Primitive data types and operators.\n\nTopics covered:\n\n- Arithmetic\n- Logic\n- Comparison Operators\n- Strings\n- Object None\n- Non-boolean Values interpreted as Booleans\n- Numeric base conversions\n- String conversions to Unicode\n- Bitwise Operations\n\nTopics to add:\n- [Complex numeric type](https://docs.python.org/3/library/functions.html#complex)\n- [Bytes and Bytesarray](https://docs.python.org/3/library/stdtypes.html#binary-sequence-types-bytes-bytearray-memoryview)\n\n\n### 2. Variables and Collections\n\nTopics covered:\n\n- Lists\n- Tuples, immutable collections\n- Unpacking\n- Dictionaries - Key-Value Collections\n- Sets | Collections without duplicates\n- Frozensets | Sets but immutable\n- Recursive Collections\n\n\n### 3. Control Flow\n\nTopics covered:\n\n- IF | Decision block\n- For Loops\n- While Loops\n- Exceptions | Try Except Else Finally\n\n### 4. Functions\n\nTopics covered:\n\n- Basic Function Definitions\n- Arbitrary parameters\n- Higher-order functions\n- Closures\n- Partial Evaluation\n- Common higher-order functions (map, filter reduce)\n- Comprehensions\n\nTopics to add:\n- [Ellipsis Object](https://docs.python.org/3/library/constants.html#Ellipsis)\n- Dictionary and Set Comprehensions\n- [Functools](https://docs.python.org/3/library/functools.html)\n\n### 5. Classes\n\nTopics covered:\n\n- Classes\n- Initializer and Instance Methods\n- Class Variables and Methods\n- Static methods\n- Dataclasses\n- Operator Overloading\n- Instances as Functions (`__call__`)\n- Properties and Deep Copy\n- Inheritance\n- Constructor (`__new__`)\n- Abstract Classes and Methods\n- Interfaces (Protocols)\n- Method Overloading\n- Mixins (Multiple Inheritance)\n- Descriptors\n\nTopics to add:\n- [Generics](https://docs.python.org/3/library/stdtypes.html#generic-alias-type)\n\n### 6. Modules and Imports Structure\n\nTopics covered:\n\n- Import Structure\n- Relative Imports\n- Programmatic Imports\n- Import Reloading\n\n### 7. Advanced Language Features\n\nTopics covered:\n\n- Additional Types\n    - NamedTuple and namedtuple\n    - Counter\n    - Defaultdict\n    - Enum\n    - SimpleNameSpace\n- Generators\n- Iterators\n- Semi-coroutines (Generators with send)\n- Corrutinas (AsyncIO)\n- Decorators\n    - Stateless decorators\n    - Stateful Decorators\n- Context Managers\n- Standard Library Pearls - Pathlib\n- Standard Library Pearls - Itertools\n- Standard Library Pearls - OS\n- Standard Library Pearls - Serialization\n- Standard Library Pearls - Emails\n\nTopics to add:\n- [TypedDict](https://docs.python.org/3/library/typing.html#typing.TypedDict)\n- [Secrets module](https://docs.python.org/3/library/secrets.html)\n\n\n### 8. Python Ecosystem\n\nThis is a special no-code chapter that consists of an infography showing which\nare the most popular libraries depending on the field. Raging from Web\nDevelopment to Data Science and QA Automation. \n\nThe image is high resolution to comfortably zooming in.\n\n### 9. Appendices\n\nTopics to add:\n\n- Caveats of dealing with floats (WIP)\n- Type Theory (Bounds, Covariant, Contravariant, Unions)\n- Metaprogramming and self-modifying code\n- MultiParadigm Programming\n\n\n## Feedback and Contact\n\nContact and feedback are much appreciated, please feel free to reach out through\n[LinkedIn](https://www.linkedin.com/in/ezequielcastano/) or by submitting a\nGitHub issue.\n\n## Inspiration\n\nThis Tutorial style was inspired by https://learnxinyminutes.com/docs/python/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felc%2Fpython-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felc%2Fpython-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felc%2Fpython-tutorial/lists"}