I would like to debug my Python code by inspecting multiple variables, dumping out their names and contents, equivalent to Raku's dd (Raku was formerly known as "Perl 6"):
The closest I've found has been mentioned in another post, which compares Python's pprint to Perl 5's Data::Dumper. However, unlike dd, neither of those outputs the name of the variable. dd in Raku is closest to the show function from the Perl 5 module Data::Show, except show additionally outputs the filename and line number.
Here is a demo of Raku's dd in action:
#!/bin/env perl6
my %a = ( :A(1), :B(2) );
my %c = ( :C(3), :D(4) );
dd %a;
dd %c;
Which, when run, results in the following :
Hash %a = {:A(1), :B(2)} Hash %c = {:C(3), :D(4)}
(By the way, a Hash in Perl or Raku is equivalent to a dictionary in Python)
And here is the closest I have yet been able to get in Python, but it redundantly requires both the name of the variable and the variable itself:
#!/usr/bin/env python
def tiny_dd(name,x):
    print(name + ' is "' + str(x) + '"')
a = { 'A':1, 'B':2}
c = { 'C':3, 'D':4}
tiny_dd('a',a)
tiny_dd('c',c)
Which, when run, results in the following:
a is "{'A': 1, 'B': 2}" c is "{'C': 3, 'D': 4}"
 
     
    