Speed of Python vs. Perl
Jeremy Fincher
jfincher at rpat-100-115.resnet.ohio-state.edu
Thu Jan 11 14:55:54 EST 2001
In article <93k78401u8s at news2.newsguy.com>, Daniel Chetlin wrote:
> @hash{0 .. 99999} = (1) x 99999;
>
>The advantages of this construct are clarity and conciseness at the
>expense of a bit of speed -- the for-loop with range operator will
>likely be a bit faster -- while remaining substantially faster than the
>C-style loop.
The disadvantage of this is that it attempts to "fill" a 100000 element
hash with 99999 elements.
That syntax, I believe, is especially *unclear* and prone to error. I
didn't even notice the error myself; another person pointed it out to
me. A simple loop is far more clear.
Jeremy
More information about the Python-list
mailing list