GitPedia

Python snippets

:100: The most useful python snippets

From progrmoiz·Updated June 11, 2026·View on GitHub·

These Snippets can make your life a lot easier than expected, use it wisely. The project is written primarily in Python, first published in 2017. Key topics include: awesome, code-snippets, collection, python.

Python Snippets

These Snippets can make your life a lot easier than expected, use it wisely.


Snippets TO LEARN

  • string_import.py example to show import module from string
  • classtools.py assorted class utilities and tools
  • formats.py various specialized string display formatting utilities.
  • mydir.py a module that lists the namespaces of other module
  • mymap.py different ways of implementing map
  • myzip.py different ways of implementing zip
  • permute.py implemented permute
  • reloadall.py transitively reload nested module
  • scramble.py a iterable scrambler
  • streams.py give me reader, writer and a converter
  • timer.py Homegrown timing tools for function calls.
  • timer2.py Homegrown timing tools for function calls.
  • timer3.py Homegrown timing tools for function calls.
  • classtree.py Climb inheritance tree using namespace links, displaying higher superclasses with indentation for height
  • listinstance.py Mix-in class that provides a formatted print() or str()
  • listinherited.py Mix-in class that provides a formatted print() or str() (Use dir() to collect both instance attr and names inherited from its classes)
  • listinherited2.py Same as listinherited.py, but more formatted
  • listtree.py Trace the entire class and all its object's attrs at and above self
  • mapattrs.py Map all attributes on or inherited by an
    instance to the instance or class from which they are inherited.

Contributing

Open an issue or a pull request to suggest changes or additions.

Authors

Abdul Moiz

License

<p xmlns:dct="http://purl.org/dc/terms/"> <a rel="license" href="http://creativecommons.org/publicdomain/zero/1.0/"> <img src="http://i.creativecommons.org/p/zero/1.0/88x31.png" style="border-style: none;" alt="CC0" /> </a> <br /> To the extent possible under law, <a rel="dct:publisher" href="https://github.com/progrmoiz/"> <span property="dct:title">Abdul Moiz</span></a> has waived all copyright and related or neighboring rights to <span property="dct:title">Snippets</span>. </p>

:arrow_up: Back To Top

Contributors

Showing top 10 contributors by commit count.

View all contributors on GitHub →

This article is auto-generated from progrmoiz/python-snippets via the GitHub API.Last fetched: 6/13/2026