Proposal for adding symbols within Python

Ben Finney bignose+hates-spam at benfinney.id.au
Mon Nov 14 00:02:30 CET 2005


Steven D'Aprano <steve at removethiscyber.com.au> wrote:
> On Mon, 14 Nov 2005 00:48:46 +1100, Ben Finney wrote:
> > I believe Pierre is looking for a syntax that will save him from
> > assigning values to names; that Python will simply assign
> > arbitrary unique values for these special names.
> 
> > What I still don't understand is why this justifies additional
> > syntax baggage in the language, rather than an explicit assignment
> > earlier in the code.
> 
> The only advantage would be if you want to do something like this:
> 
> MO, TU, WE, TH, FR, SA, SU = Symbols()

I believe that's exactly what Pierre doesn't want to do. He wants to
simply use names (marked special in some way) and have Python
automatically determine a unique value for each name, with nary an
assignment in sight.

To me, that's a net loss. It makes names more complicated, it loses
"explicit is better than implicit", and it loses the checks Python
could do against using a name that hasn't been assigned a value
(caused by e.g. a misspelled name).

-- 
 \      "Why should I care about posterity? What's posterity ever done |
  `\                                         for me?"  -- Groucho Marx |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list