Python Buddy is a tool to help you learn coding in Python. It explains how to read and better understand Python code in a step-by-step fashion.
This repository is for tracking issues and feature requests for Python Buddy.
Type | Name | Description |
---|---|---|
Built-in | collections |
High-performance container datatypes |
Built-in | functools |
Higher-order functions and operations on callable objects |
Built-in | math |
Mathematical functions |
Third-party | numpy |
Scientific computing with Python |
Third-party | pandas |
Data analysis and manipulation tool |
Custom | (WIP) cs1010s_runes |
CS1010S-specific functions for rendering runes – ported to work with Python Buddy |
Want more modules? File a feature request here.
I'm actively working on supporting more and more features of the language, with the goal of covering the necessary features for basic Python learning first. Here's what's currently supported, as well as the features I'm working on next:
a = 1
a, b = 1, 2
a, *b, c = 1, 2, 3, 4
a := 1
+
, -
, *
, /
, //
, %
, **
==
, !=
, >
, <
, >=
, <=
, in
, not in
, is
, is not
+=
, -=
, *=
, /=
, //=
, %=
, **=
and
, or
+3
, -3
, not 3
del
keyword: del a
my_list = [1, 2, 3]
my_list[0]
my_list[0:2]
my_list[0:2:2]
a if b else c
if
, elif
, else
while True
for x in my_list:
for x, y in zip(my_list, reversed(my_list)):
for...else
and while...else
loopsbreak
and continue
statements[x for x in my_list]
[x, y for x in my_list for y in my_list]
{x: x for x in my_list}
{x for x in my_list}
(x for x in my_list)
def my_func(a, b, c):
my_func(a, b, c)
my_func(a=1, b=2, c=3)
def my_func(a, b, c, /)
def my_func(*, a, b, c)
return
statementsyield
statementsmy_list.append(1)
lambda x: x + 1
class MyClass:
self.my_attr = 1
class MyClass: my_attr = 1
class MyClass: def my_method(self):
class MyClass: @classmethod def my_method(cls):
class MyClass: @staticmethod def my_method():
class MyClass(MyParentClass):
class MyClass(MyParentClass1, MyParentClass2):
import numpy as np
from numpy import array
from numpy import *
f'Hello, {name}!'
Note: CS1010_ refer to the codes of some courses offered by the National University of Singapore.
Caveats describe how Python Buddy's implementation intentionally differs from the official Python language specification.
Any differences not described here should be considered bugs. Please open an issue if you find one!
Python Buddy does not support assignment expressions (also known as the "walrus operator") yet.
Until it does so, normal assignments and multiple assignments are value-producing (unlike standard Python). In the case of the latter, a tuple is produced.
This does not mean they can be used as expressions, though, as that would violate python syntax.
The iterator of the for loop is evaluated all at once and coerced to a list. This is not meant to be permanent, and simply a workaround due to lack of support for generator expressions for now. As a consequence, there may be some edge cases involving early return, break, or continue statements wher Python Buddy gives an incorrect result.
Implication: If your iterator has side effects, they will be evaluated first before the body of the for loop is even executed once.