I come to praise .join, not to bury it...

Steve Holden sholden at holdenweb.com
Tue Mar 6 19:35:53 EST 2001


"Mike C. Fletcher" <mcfletch at home.com> wrote in message
news:mailman.983890030.6303.python-list at python.org...
> Here's a professional aesthetic's take:
>
A professional would call themself an aesthete :-)

> mystring.join( )
>
> This is a perfectly normal and good-looking construct.  It seems pythonic
> and beautiful, object orientation is part of Python, and this works
nicely.
>
Agreed.

> "'".join( )
> ";".join( )
> ".".join( )
> "!".join( )
> ",".join( )
>
> All look like executable line noise.  That is, the literal string's syntax
> makes the use of dotted attributes on such a string look jarring and
> off-putting.  You almost expect some weird function to jump out of this
> syntax.  It looks very Ruby/Perl-esque.
>
Just the same, a beginner can read the code as "some string's method is
applied to whatever argument is passed" just by knowing the syntax.

> Note particularly the amount of space between the " character and the .
> character.  Typographically, " characters serve to set the enclosing data
> off from the outer context, and that's the opposite of what you're trying
to
> do with dot notation.  Dot notation normally looks natural because almost
> every character that gets used right before the . comes fairly close to
the
> .  (even characters such as r ).  Also note: in the common cases of
> single-character joins, there's no significant visual weight difference
> between what's inside and outside the quotes).  Consider what happens when
> you alter the proportions of space and the size of the connector...
>
Well, if you like white space Python should be the perfect language for you!

> "."__join( )
> "."-->join( )
> "."..join( )
> " "__join( )
>
> You should find those slightly easier on the eyes (except possibly the " "
> one) because the entire "." entity can be understood as a single graphic
> with a connector to "join".
>
What about the currently syntactically-acceptable

>>> ", " . join(["big", "fat", "joint"])
'big, fat, joint'
>>>

Remember that technically the dot is an operator. Personally I find the
extra whitespace intrusive, but that is a matter of style and taste. Any
better for you?

> That said, I don't think we'll get this particular wart out of the
language,
> so we'll have to deal with the flaw in the way artists have through the
> ages, enhance it and accent it so people start to think it's a beauty
mark.
>
Not a wart, but a consistent application of object-oriented principles.
Sorry. I too wish the world looked more beautiful (to you).

but-if-wishes-were-horses-then-bill-gates-would-have-hoofmarks-in-his-ass-ly
y'rs  - steve






More information about the Python-list mailing list