language design question

Paddy paddy3118 at netscape.net
Sun Jul 9 15:19:10 EDT 2006


Gregory Guthrie wrote:
> I am comparing Python to a few other scripting languages, and used a simple
> anagrams program as a sample.
>
> I was surprised ast a few python features that did not work as I would
> expect/wish; which caused less compact/expressive program styles that I
> wanted - reverting to a FORTRAN like series of assignments.
>
<SNIP>
> The former seems very intuitive, and clearer.
> I am a bit used to the compactness and convenient defaults of Perl, which
> would do this:
>    my $key = join '', sort(split(//, lc($word)));
>     push @{$anagrams{$key}}, $word
>
> I am curious why these "obvious" conveniences are not present.  :-)
> Thansk for any context or insight.
>
> Best,
> Gregory
>
> Perl is great, and
You might try looking for anagram programs written by Python
programmers and compare them to anagram programs written by peoplle
thatknow and use other languages.
That way you might get around the fact that Python is a unique language
with its own way of doing things. If you now one language and try and
apply its idioms to another then you are bound to think that the other
language is less good at solving prolblems in the first languages way.

Googling for Python Anagram, brought up
http://www.voidspace.org.uk/python/nanagram.html#demo-version

maybe you should look at the source code to nanagram for comparison.

- Paddy.




More information about the Python-list mailing list