[Tutor] Pythonic? Building a full path from a "visual" file tree

stv stvsmth at gmail.com
Tue Mar 21 21:20:07 CET 2006


> The list comp is fine but I don't think you need it
> at all, since you strip() the string before you
> add it to stack.

Ahh yes. I used the rstrip() in development, printing intermediary
output to stdout, so I could see what my input file-to-list looked
like (and it looked ugly with all those EOLs). The strip() to the
stack is there primarily to remove the indentation but, of course, it
can do double duty.

>
> string.join() is deprecated, ''.join() is preferred.
>

Well, I'll live with it ;-) fugly as it looks. I'm really finding that
Python nudges me into pleasant code. Doing the above in somthing like
VB, I would just brute-force it and it would feel right. Brute forcing
it in Python ... well, it just feels wrong  ... Thanks for the input.


More information about the Tutor mailing list