On this page
antigravity
Prev: annotationlib | Up: stdlib_module | Next: argparse
Rel: sys, sysconfig, builtins, warnings, dataclasses
Ref: docs.python.org — antigravity
Tags: #public #python3 #stdlib
Import
import antigravity
Overview
Classic Python Easter egg module inspired by xkcd #353 ("Python"): importing antigravity opens the xkcd Python comic in your default web browser via webbrowser, and also includes a whimsical geohash() implementation referencing xkcd #426. Purely a fun piece of Python culture—not a production dependency.
Quick Start
# Note: `import antigravity` immediately calls webbrowser.open("https://xkcd.com/353/")!
# It also defines antigravity.geohash(latitude, longitude, datedow) using hashlib.md5.
Implementation Walkthrough
1. What Happens on Import
At module top level, antigravity.py executes webbrowser.open("https://xkcd.com/353/") and defines geohash(latitude, longitude, datedow), which hashes datedow with MD5 to compute xkcd #426 geohash coordinates.
Gotchas & Boundaries
- Import-time side effect: Simply running
import antigravitylaunches a browser window (or prints a URL in headless environments). Never import it in automated tests or libraries.
Linked from
Related notes
- tuts/python3/stdlib_module/annotationlib Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/argparse Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/stdlib_module Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/builtins Linked here; shared tags: #stdlib
- tuts/python3/stdlib_module/dataclasses Linked here; shared tags: #stdlib
- tuts/python3/stdlib_module/sys Linked here; shared tags: #stdlib
- tuts/python3/stdlib_module/sysconfig Linked here; shared tags: #stdlib
- tuts/python3/stdlib_module/warnings Linked here; shared tags: #stdlib
- tuts/python3/stdlib_module/webbrowser Linked here; shared tags: #stdlib