Just remember that Python is sexy

Eric Pederson whereU at now.com
Tue May 31 01:57:39 EDT 2005


> I often can't remember that to remove spaces from a string whether it's
> strip() or trim(), and when finding patterns with the re library
> whether it's find() or search() and when iterating over key, values of
> a dictionary whether it's items() or entries().
> But then I remember that Python is "sexy".
> It is sexier to strip() than to trim().
> You do a strip search() not a find() search.
> And you remove items() of clothing and not entries() of clothing.


Genius!  I will never perplex myself with string_foo.trim() again. (I do forget)

I recommend this be adopted as a naming standard for Python methods:

    "The method name should have a sexy connotation"












Eric Pederson
http://www.songzilla.blogspot.com
:::::::::::::::::::::::::::::::::::
domainNot="@something.com"
domainIs=domainNot.replace("s","z")
ePrefix="".join([chr(ord(x)+1) for x in "do"])
mailMeAt=ePrefix+domainIs
:::::::::::::::::::::::::::::::::::




More information about the Python-list mailing list