Question mark in variable and function names

Michael J. Fromberger Michael.J.Fromberger at Clothing.Dartmouth.EDU
Wed Oct 6 22:30:31 CEST 2004


In article <1gl90yk.v91yz8w1z0b2N%aleaxit at yahoo.com>,
 aleaxit at yahoo.com (Alex Martelli) wrote:

> Andr? N?ss <andre.naess at gmail.com> wrote:
> 
> > One thing I liked about Lisp was the ability to use the question mark
> > (and the exclamation mark) in function names. [...]
> 
> Even though I haven't used Lisp extensively, I agree with you.  [...]
>
> ops which modify their arguments with a trailing bang, IS a great idea
> for readability. [...]
> 
> Ruby has this convention and it seems to work wonderfully well for them.
> I wish Python could grow it, too, but I don't think I stand any chance
> of convincing Guido -- perhaps somebody else can.

I also like this convention in Scheme, but I don't like the way it looks 
in an infix-laden language like Python.  

Whereas:
  (predicate? arg1 arg2 ... argn)

... looks good and legible to me, I find:

  predicate?(arg1, arg2, ..., argn)

... far less appealing, because of the juxtaposition of ?(.  

I realize this is purely a personal aesthetic distaste, but Python is 
generally quite a pretty language, and I'm afraid this addition, as 
sensible as it is, might work against that for comparatively little 
benefit.

Cheers,
-M

-- 
Michael J. Fromberger             | Lecturer, Dept. of Computer Science
http://www.dartmouth.edu/~sting/  | Dartmouth College, Hanover, NH, USA



More information about the Python-list mailing list