>>> from expressions import items_count_2 >>> items_count_2('((x[i]+2)*(3*r[4]/z)))') (4, 11) >>> items_count_2('(f(x)))//(5*x[2]-y)') (4, 9) >>> items_count_2('{4:{5:[3, 4], 6:[7, 8]}, 9:[1, 2, 3, 4, 5]}') (0, 10) >>> items_count_2("d[4] = {'a':'((x+2)*(3*r/z))}'") (5, 10)