The Artima Developer Community
Sponsored Link

Python Buzz Forum
Python nit, chapter 1

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
Ian Bicking

Posts: 900
Nickname: ianb
Registered: Apr, 2003

Ian Bicking is a freelance programmer
Python nit, chapter 1 Posted: Oct 24, 2003 4:19 PM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Ian Bicking.
Original Post: Python nit, chapter 1
Feed Title: Ian Bicking
Feed URL: http://www.ianbicking.org/feeds/atom.xml
Feed Description: Thoughts on Python and Programming.
Latest Python Buzz Posts
Latest Python Buzz Posts by Ian Bicking
Latest Posts From Ian Bicking

Advertisement

I like Python. But there are little things that aren't quite right to me. In this extended series I will gripe about them.

First up, string.join (or str.join as we should now call it). We all know the basic gripe, this looks funny:

>>> sep = '\n'
>>> doc = sep.join(lines)
It should be:
>>> doc = join(lines, sep)
But I realized the realproblem is about typography as much as the order of the arguments. Because most of the time when I'm joining things, I'm doing it like:
>>> doc = '\n'.join(sep)
The ' doesn't line up with the .join at all. Other string methods aren't a problem, because you never call them on string literals (except maybe split, but then only to save a few keystrokes).

I can understand why Guido didn't want to add a join method to sequencees. And some people do tend to panic when they consider more builtins (mostly purists who like the idea of a small language). Anyway, it's still a gripe for me.

Read: Python nit, chapter 1

Topic: Some links Previous Topic   Next Topic Topic: Thought of the day

Sponsored Links



Google
  Web Artima.com   

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