Skip to content

Quadstronaut/PunyPython

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐍 PunyPython

Possessing prodigious potential for producing pragmatic and proficient Python programs.

Python Platform License

Last Commit Repo Size Top Language


About Structure How to Use Philosophy License Contributing


πŸ“– About

PunyPython is a Python-only educational reference repository. Every file is a runnable, heavily-commented script you can read, copy, paste, and experiment with.

What Details
πŸŽ“ Primary section LearnXinY/ β€” structured transcription of the canonical Learn X in Y Minutes β€” Python guide (Β© its contributors, CC BY-SA 3.0), each topic expanded with up to two additional original examples per concept
🀝 Co-authored with Claude (Anthropic), original supplemental examples also released under CC BY-SA 3.0
βš™οΈ Algorithm folders Arrays/, Lists/, Textual/, Mathmatical/ β€” multiple approaches to common problems, side-by-side for trade-off comparison
πŸ“œ License Always Creative Commons. No proprietary content will ever be added.

Note

The LearnXinY/ section is a structured transcription of the canonical Learn X in Y Minutes β€” Python guide (Β© its contributors, Creative Commons Attribution-ShareAlike 3.0 Unported). Each topic is expanded with up to two additional original examples per concept, co-authored with Claude (Anthropic), also released under CC BY-SA 3.0.


πŸ—‚οΈ Repository Structure

PunyPython/
β”‚
β”œβ”€β”€ LearnXinY/                     ← Core language reference (learnxinyminutes transcription)
β”‚   β”œβ”€β”€ Primitives/
β”‚   β”‚   β”œβ”€β”€ numbers.py             β€” integers, floats, arithmetic, operator precedence
β”‚   β”‚   β”œβ”€β”€ strings.py             β€” creation, slicing, methods, f-strings, translate
β”‚   β”‚   └── booleans_and_none.py   β€” bool ops, comparisons, short-circuit, truthiness
β”‚   β”‚
β”‚   β”œβ”€β”€ Variables/
β”‚   β”‚   └── assignment.py          β€” basic assignment, unpacking, swap, augmented, annotations
β”‚   β”‚
β”‚   β”œβ”€β”€ Collections/
β”‚   β”‚   β”œβ”€β”€ lists.py               β€” creation, indexing, slicing, mutation, methods
β”‚   β”‚   β”œβ”€β”€ tuples.py              β€” immutability, unpacking, namedtuple, memory
β”‚   β”‚   β”œβ”€β”€ dictionaries.py        β€” access, views, mutation, merge, Counter, defaultdict
β”‚   β”‚   └── sets.py                β€” operations, algebra, frozenset, deduplication
β”‚   β”‚
β”‚   β”œβ”€β”€ ControlFlow/
β”‚   β”‚   β”œβ”€β”€ conditionals.py        β€” if/elif/else, ternary, match/case, guard clauses
β”‚   β”‚   β”œβ”€β”€ loops.py               β€” for, while, range, enumerate, zip, break/continue/else
β”‚   β”‚   β”œβ”€β”€ exceptions.py          β€” try/except/else/finally, raise, custom exceptions, with
β”‚   β”‚   └── comprehensions.py      β€” list, set, dict comprehensions; generator expressions
β”‚   β”‚
β”‚   β”œβ”€β”€ Functions/
β”‚   β”‚   β”œβ”€β”€ basics.py              β€” def, return, scope, first-class, map/filter, lru_cache
β”‚   β”‚   β”œβ”€β”€ args_and_kwargs.py     β€” *args, **kwargs, keyword-only, positional-only, unpacking
β”‚   β”‚   β”œβ”€β”€ closures_and_lambdas.py β€” closures, nonlocal, lambda, operator module
β”‚   β”‚   β”œβ”€β”€ decorators.py          β€” @decorator, @wraps, arguments, stacking, class decorators
β”‚   β”‚   └── generators.py          β€” yield, generator expressions, yield from, send, pipelines
β”‚   β”‚
β”‚   β”œβ”€β”€ Modules/
β”‚   β”‚   └── imports.py             β€” import, from/import, aliases, stdlib highlights, __name__
β”‚   β”‚
β”‚   └── Classes/
β”‚       β”œβ”€β”€ basics.py              β€” class, __init__, instance attrs, __str__/__repr__, dataclass
β”‚       β”œβ”€β”€ properties_and_statics.py β€” @property, @classmethod, @staticmethod, cached_property
β”‚       β”œβ”€β”€ inheritance.py         β€” single, multiple inheritance, super(), MRO, ABC, mixins
β”‚       └── magic_methods.py       β€” arithmetic, comparison, container, context manager, __call__
β”‚
β”œβ”€β”€ Arrays/
β”‚   β”œβ”€β”€ rotate/                    β€” 5 approaches to array rotation
β”‚   β”œβ”€β”€ sum_of_array/              β€” 5 approaches to summing an array
β”‚   └── largest_element/           β€” 6 approaches to finding the largest element
β”‚
β”œβ”€β”€ Lists/
β”‚   └── swap_first_last/           β€” 4 approaches to swapping list ends
β”‚
β”œβ”€β”€ Textual/
β”‚   β”œβ”€β”€ hello_world.py
β”‚   β”œβ”€β”€ ascii_value_of_char.py     β€” print ASCII value of every character in user input
β”‚   └── remove_nth_char.py         β€” remove the character at index n (0-based) from a string
β”‚
β”œβ”€β”€ Mathmatical/
β”‚   β”œβ”€β”€ Armstrong_number_check.py
β”‚   β”œβ”€β”€ factorial/                 β€” 4 approaches (one requires numpy: pip install numpy)
β”‚   β”œβ”€β”€ maximum_of_2_numbers/      β€” 6 approaches
β”‚   └── add_2_numbers/             β€” 6 approaches
β”‚
└── venv_manager.py                β€” CLI tool for managing Python virtual environments
                                     (Unix-first; Windows-compatible with caveats β€” see script header)

Folder Map at a Glance

graph TD
    ROOT["🐍 PunyPython"]

    ROOT --> LXY["πŸ“š LearnXinY/\nCore language reference"]
    ROOT --> ARR["πŸ”’ Arrays/\n5–6 approaches each"]
    ROOT --> LST["πŸ“‹ Lists/\n4 approaches"]
    ROOT --> TXT["πŸ”€ Textual/\n3 scripts"]
    ROOT --> MTH["βž• Mathmatical/\n4–6 approaches each"]
    ROOT --> VNV["βš™οΈ venv_manager.py\nCLI venv tool"]

    LXY --> PRI["Primitives\nnumbers Β· strings Β· booleans"]
    LXY --> VAR["Variables\nassignment"]
    LXY --> COL["Collections\nlists Β· tuples Β· dicts Β· sets"]
    LXY --> CFW["ControlFlow\nconditionals Β· loops Β· exceptions Β· comprehensions"]
    LXY --> FUN["Functions\nbasics Β· args Β· closures Β· decorators Β· generators"]
    LXY --> MOD["Modules\nimports"]
    LXY --> CLS["Classes\nbasics Β· properties Β· inheritance Β· magic_methods"]

    ARR --> AR1["rotate/ β€” 5 approaches"]
    ARR --> AR2["sum_of_array/ β€” 5 approaches"]
    ARR --> AR3["largest_element/ β€” 6 approaches"]

    MTH --> MT1["factorial/ β€” 4 approaches"]
    MTH --> MT2["maximum_of_2_numbers/ β€” 6 approaches"]
    MTH --> MT3["add_2_numbers/ β€” 6 approaches"]
    MTH --> MT4["Armstrong_number_check.py"]
Loading

πŸš€ How to Use

Each file in LearnXinY/ is self-contained. Open any file and run it, or just read it β€” all examples are written as expressions and print statements you can follow top to bottom.

python LearnXinY/Primitives/numbers.py
python LearnXinY/Collections/lists.py
python LearnXinY/Classes/inheritance.py

For the algorithm files, compare the approaches side by side to see the trade-offs between readability, performance, and Python idiom.

Tip

One approach in Mathmatical/factorial/ requires NumPy. Install it first with:

pip install numpy

πŸ’¬ Commenting Philosophy

The comment depth scales with topic complexity β€” purposely pedagogical, not pedantic:

Level Topics Comments focus on…
🟒 Rudimentary Primitives, Variables What each line does
🟑 Intermediate Collections, ControlFlow Why a pattern is used, what pitfall it avoids (e.g. mutable default arguments, falsy-value traps)
πŸ”΄ Advanced Functions, Classes When to reach for a technique and what its trade-offs are (e.g. when generators beat list comprehensions, when __slots__ saves memory, how MRO cooperates in multiple inheritance)

Important

The Advanced tier (Functions, Classes) is where the most educational density lives. Don't skip the comments β€” they're half the point.


βš–οΈ Attribution & License

Full attribution details (click to expand)
  • Core examples transcribed from Learn X in Y Minutes β€” Python, Β© its contributors (Louie Dinh, Steven Basart, Andre Polykanine, and others). Licensed under Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0).

  • Original supplemental examples (marked co-authored with Claude in each file) Β© quadstronaut & Claude (Anthropic), also released under CC BY-SA 3.0.

  • Algorithm files in Arrays/, Lists/, Textual/, and Mathmatical/ are original implementations by the repository contributors, released under CC BY-SA 3.0.

Important

This repository will always remain Creative Commons. No proprietary content will be added.


🀝 Contributing

This is a Python-only repository for educational purposes. Contributions that add new Python examples, fix errors, or improve comments are welcome.

Note

Please keep the same commenting style and CC BY-SA 3.0 license header in new files.

About

Possessing prodigious potential for producing pragmatic and proficient Python programs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages