invert or reverse a string... warning this is a rant

Gabriel Genellina gagsl-py at yahoo.com.ar
Thu Oct 19 21:22:34 EDT 2006


At Thursday 19/10/2006 21:07, Brad wrote:

> > Gah!!! That's *awful* in so many ways.
>
>It has been my experience that Python has discouraging forums with
>someone always calling someone else an idiot or telling them they are
>awful in some way. I love Python, but the community is way too negative,
>uptight and generally down on users who do not have PhD's in CS or Math.

I agree with you being angry.
It's true that our posts are going to stay for a long time, and 
people could find and read them, and perhaps copy and use our posted 
code. So when something is not up-to-the-standard or not following 
the best practices or is not the best way of doing things, that 
should be noted.
Certainly there is no need to be rude! Pointing out the deficiencies 
and how to avoid them can be done in a kind manner.
But I don't think that "the community" in general is too negative. 
It's a lot more "newbie-friendly" than other popular language's.

> > (1) The name is bad. "invert" is not the same as "reverse". Here's an
> > invert: 1/2 = 0.5. Your function falsely claims numbers aren't invertable.
>
>Dictionary.com
>invert = to reverse in position, order, direction, or relationship.

Note that even on a mathematical sense, "inverse" does not mean only 
"multiplicative inverse". -3 is the "additive inverse" of 3, by 
example (See <http://mathworld.wolfram.com/AdditiveInverse.html>). 
(BTW, integers -except two of them- are not inversible in Z).
So "invert" is not a bad name "per se". But having the reversed() 
builtin and reverse() list method implies that a similarly rooted 
name would be better (just to be coherent!) - perhaps reversed_string()?


-- 
Gabriel Genellina
Softlab SRL 

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar



More information about the Python-list mailing list