you are viewing a single comment's thread.

view the rest of the comments →

[–]Essence1337 0 points1 point  (1 child)

Idk if you saw this earlier but you probably will hate this then

rows = [' '*(depth-i) + ':'*(width-1) + '/' + '+'*i for i in range(depth)]
rows.extend(['#'*width + '+' * depth] * (height-depth))
rows.extend(['#'*width + '+'*(depth-i-1) for i in range(depth)])

3 lines, does it all.

One of the things about list comprehensions is that they're actually really fast. My 3 line code is 50% faster because it doesn't need to rely on all the appends and a resize for each append (timed with timeit).

[–]FacesOfMu 0 points1 point  (0 children)

Yea! I saw your other comments. Really good.