The Artima Developer Community
Sponsored Link

Python Answers Forum
Should join() be moved?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Richard Prosser

Posts: 3
Nickname: rprosser
Registered: Jul, 2005

Should join() be moved? Posted: Jul 18, 2005 8:23 AM
Reply to this message Reply
Advertisement
Like many Pythoneers I suspect, I find the current join() method implementation to be rather odd. Typically, to insert a space between a sequence of strings, you have to use the construct ' '.join(seq). A more intuitive approach is seq.join(), which employs a space as separator by default.

Another way of looking at this is to realise that we are using inverse operations: seq.split() <=> seq.join(), which is what one would normally expect I believe. The current way of applying join() to a string just doesn't make semantic sense.

The elements of the sequence in question have to be strings of course, but that is true in both cases.

I am tempted to raise a PEP for this, but I haven't done that before, and there may well have been prior discussions on the issue that I am not aware of. Further, changing the type that join() applies to would break existing code.

Any comments?


Cheers ...

Richard Prosser

Topic: running btreannounce.py Previous Topic   Next Topic Topic: Run only one instance

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use