Python's qw
Fernando Perez
fperez528 at yahoo.com
Fri May 16 19:00:33 EDT 2003
Skip Montanaro wrote:
>
> Fernando> In those cases, a simple split works (I use it a lot). A
> Fernando> typical example:
>
> ...
>
> In case anyone thinks Fernando is just plain weird, I assure you he's not
> (at least not in this case ;-). This same technique is used in the
> platform-specific expected skip lists of the Python unit testing framework.
> We have the BDFL to thank for that particular bit of code, so I doubt the
> technique can come with a stronger recommendation.
Huh ? Honestly, what is weird about that code? It seemed the most natural
thing to write the first time I needed a list of words. After I'd decided that
I should ditch my homebrewed qw() for a more pythonic idiom, I tried the first
thing that 'should' work, and it did.
That's one of the beautiful things about python: if a solution 'feels' natural,
there's a good chance it's also the right one (try that with a list of lists of
hashes in perl, and see how far you get ;).
Anyway, I'm asking out of genuine curiosity. I don't mind your comment in the
slightest, but I am curious as to why anyone would find the above code 'weird'.
Cheers,
f.
More information about the Python-list
mailing list