Python Oddity - print a reserved name

Michael Hudson mwh at python.net
Wed Sep 15 17:26:12 CEST 2004


aleaxit at yahoo.com (Alex Martelli) writes:

> This kind of thing, however, is also true of CPython whenever it's
> accessing "outside" objects through attributes; and for .NET
> implementations I believe that CLR compliant languages are not
> allowed to forbid certain method names along their interfaces to
> other components.  I'm not sure how CORBA's standard Python bindings
> address the same problem, how it's met in various interfaces to
> XML-RPC, COM, SOAP, and other distributed-objects or foreign-objects
> APIs.

I'm fairly sure the approach taken by CORBA bindings is the good old
"append an underscore" hack.  I don't know what happens if an
interface declares methods called both "print" and "print_", but
giving the author a good kick seems an appropriate response...

> Given how pervasive this problem is, I do recall some ruminations
> about allowing arbitrary identifiers in the specific case in which
> they fall right after a dot in a compound name.  I don't recall that
> anything ever came of these ruminations, though.

I think the only problem is that noone has done the work yet.
Python's parser isn't the nicest thing ever.  Two snippings spring to
mind:

	/* This algorithm is from a book written before
	   the invention of structured programming... */

(Parser/pgen.c from the Python source).

<glyph> It's interesting that people often say "Hey, I'm looking for
        something to work on!"
<glyph> then someone else says "Glyph's code needs a little help."
        then the original asker says "SWEET MARY MOTHER OF GOD I'M NOT
        TOUCHING THAT!  I mean, uh, that's too much work or I'm not
        good at it.  Or something."

(from Twisted.Quotes).

It's not my itch, and I'm not that interested in learning how to
scratch it...

Cheers,
mwh

-- 
  Finding a needle in a haystack is a lot easier if you burn down
  the haystack and scan the ashes with a metal detector.
      -- the Silicon Valley Tarot (another one nicked from David Rush)



More information about the Python-list mailing list