gah! I hate the new string syntax

Skip Montanaro skip at mojam.com
Mon Mar 5 20:45:05 EST 2001


    Sean> Turning a string literal (";") suddenly into a string object and
    Sean> then using its methods is not an easy read.

In Python, everything is an object.  Thus, a string literal is a string
object - no "turning into" required.  Just because it wasn't created by
instantiating a class doesn't make it any less an object.

The presence of join methods for strings and why that's where they landed
has been hashed and rehashed several times.  Please check out FAQ 4.96 for
details.

    Sean> ";" . join() # in perl, this means concat ";" with the result of
    Sean> join()

Nobody ever claimed that Python was trying to be Perl... ;-) Just because
'";".join' is a fragment of valid expressions in both languages doesn't mean
they have to mean the same thing.

(In reality, I actually do my best to make my Perl code look as much like
Python to my Python-infected mind as I can.)

-- 
Skip Montanaro (skip at mojam.com)
Support Mojam & Musi-Cal: http://www.musi-cal.com/sponsor.shtml
(847)971-7098




More information about the Python-list mailing list