Python
1991fragletgeneral-purposeimperativeobject-orientedfunctional.py.pyw
docker run --rm --platform="linux/amd64" 100hellos/python:latest
MCP + fragletc
MCPstdinargs
This language supports code execution via MCP and the fragletc CLI. Stdin piping and argument passing are both supported.
Install fragletc →Python is a general-purpose imperative and object-oriented language first appearing in 1991.
Hello World
#!/usr/bin/env python3
if __name__ == "__main__":
print("Hello World!")Coding Guide
Language Version
Python 3.x
Execution Model
- Interpreted, runs directly from source
- Code executes at the top level
- Main execution block:
if __name__ == "__main__":
Key Characteristics
- Indentation-sensitive (4 spaces standard)
- Dynamic typing
- Case-sensitive
Fragment Authoring
Write valid Python statements or expressions. Your fragment becomes the script body, so code runs at the top level of the script.
Available Packages
Standard Python library is available. No additional packages are pre-installed.
Common Patterns
- Print:
print("message") - Main guard:
if __name__ == "__main__": - Functions:
def function_name(): - List comprehensions:
[x*2 for x in range(10)] - String formatting:
f"Value: {value}"
Examples
# Simple output
print("Hello, World!")
# Function definition
def greet(name):
return f"Hello, {name}!"
print(greet("Alice"))
# List processing
numbers = [1, 2, 3, 4, 5]
squared = [x**2 for x in numbers]
print(f"Sum of squares: {sum(squared)}")Fraglet Scripts
Echo Args
#!/usr/bin/env -S fragletc --vein=python
import sys
print("Args:", " ".join(sys.argv[1:]))Extension Infer
print("Inferred from .py extension!")File Input
#!/usr/bin/env -S fragletc --vein=python
for i in range(3):
print(f"Count: {i}")Hello
#!/usr/bin/env -S fragletc --vein=python
print("Hello, Python!")Multiline
#!/usr/bin/env -S fragletc --vein=python
def greet(name):
return f"Hello, {name}!"
print(greet("Fraglet"))Stdin Upper
#!/usr/bin/env -S fragletc --vein=python
import sys
for line in sys.stdin:
print(line.strip().upper())Test
#!/usr/bin/env -S fragletc --vein=python
if __name__ == "__main__":
print("Hello World!")Connections
influenced by